前端之家收集整理的这篇文章主要介绍了
UI基础控件综合案例之XML布局编写,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
UI基础控件综合案例之案例介绍及案例分析
- XML
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >
-
- <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#2dffff00" android:text="选餐Start!" android:textColor="@color/blueviolet" android:textSize="25sp" android:textStyle="bold|italic" android:typeface="monospace" />
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#2dff0000" android:orientation="vertical" >
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" >
-
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="姓名" />
-
- <EditText android:id="@+id/et_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="请输入姓名" />
- </LinearLayout>
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:orientation="horizontal" >
-
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="性别" />
-
- <RadioGroup android:id="@+id/rg_sex" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" >
-
- <RadioButton android:id="@+id/rb_man" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="男" />
-
- <RadioButton android:id="@+id/rb_woman" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="女" />
- </RadioGroup>
- </LinearLayout>
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" >
-
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="喜好" />
-
- <CheckBox android:id="@+id/cb_hot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="辣" />
-
- <CheckBox android:id="@+id/cb_fish" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="海鲜" />
-
- <CheckBox android:id="@+id/cb_sour" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="酸" />
- </LinearLayout>
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:orientation="horizontal" >
-
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="预算" />
-
- <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="0元" />
-
- <SeekBar android:id="@+id/sb_price" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="3" android:max="100" />
-
- <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="100元" />
- </LinearLayout>
-
- <Button android:id="@+id/btn_find" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@color/blueviolet" android:text="寻找商品" />
- </LinearLayout>
-
- <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#3d00ff00" android:orientation="vertical" >
-
- <ImageView android:id="@+id/iv_pic" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="3" android:src="@drawable/ic_launcher" />
-
- <ToggleButton android:id="@+id/tb_click" android:layout_width="match_parent" android:layout_height="0dp" android:layout_margin="5dp" android:layout_weight="1" android:background="@color/blueviolet" android:textOff="下一个" android:textOn="显示信息" />
- </LinearLayout>
-
- </LinearLayout>