6 Android UI组件使用
1. 文本视图:TextView
<TextView
//指定ID
android:id=”@+id/tv_test1_message”
//宽度
android:layout_width=”match_parent”
//高度
android:layout_height=”match_parent”
//文本
android:text=” ”
//文本颜色
android:textcolor=” “
//文本大小
android:textsize=” “
2. 文本输入框:EditText
<EditText
//默认提示文本
android:hint=” “
//输入数据类型限定
android:inputTape=” “
3. 按钮:button
<Button
//宽度
android:layout_width=”match_parent”
//高度
android:layout_height=”match_parent”
//按钮文本
android:text=” ”
//按钮文本大小
android:textsize=” “
4. 图片视图:ImageView
<ImageView
//背景图片
android:background=” “
//前景图片
android:src=” “
5. 多选框:CheckBox
<CheckBox
//标识默认是否勾选
android:checked=”true”
6. 单选框:RadioGroup/RadioButton
<RadioGroup
//指定ID
android:id=”@+id/rg_test1_sex”
//宽度
android:layout_width=”fill_parent”
//高度
android:layout_height=”fill_parent”
android:orientation=”horizontal”
<RadioButton
//设置某个状态被选中
android:checked=”true”
7. 文本小提示:Toast
6 Android UI组件使用
最新推荐文章于 2023-10-30 20:46:27 发布