Android物联网应用程序开发(智慧城市)—— 环境状态值范围设置界面开发
效果图:
代码:
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--设置界面-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dip"
android:gravity="center"
android:orientation="horizontal"
android:background="@color/titleColor">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="20sp"
android:text="设置"/>
</LinearLayout>
<!--温度范围-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip">
<TextView
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:gravity="center"
android:text="温度范围"/>
<EditText
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:ems="10" />
<TextView
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:gravity="center"
android:text="至" />
<EditText
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:layout_marginRight="50dip"
android:ems="10"/>
</LinearLayout>
<!--湿度范围-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<TextView
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:layout_gravity="center"
android:text="湿度范围"/>
<EditText
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:ems="10"/>
<LinearLayout
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginRight="50dip">
</LinearLayout>
</LinearLayout>
<!--光照范围-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<TextView
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:layout_gravity="center"
android:text="光照范围"/>
<EditText
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:ems="10"/>
<LinearLayout
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginRight="50dip">
</LinearLayout>
</LinearLayout>
<!--CO:-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip">
<TextView
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:layout_gravity="center"
android:text="CO:"/>
<EditText
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:ems="10"/>
<LinearLayout
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginRight="50dip">
</LinearLayout>
</LinearLayout>
<!--按钮-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dip">
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="保存"/>
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="重置"/>
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="取消"/>
</LinearLayout>
</LinearLayout>
本文来自博客园,作者:明金同学,转载请注明原文链接:https://www.cnblogs.com/vmuu/p/15663410.html
公众号:【明金同学】