1、文本框组件:
<TextView
android:layout_width="match_parent" 适应屏幕宽度
android:layout_height="wrap_content" 适应内容高度
android:text="@string/text1" 文字内容
android:textSize="40sp" 设置字体大小
android:textColor="#0fabe5" 设置字体颜色
android:singleLine="true"/> 设置文本框单行
2、编辑框组件:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入名称"
android:inputType="textPassword" 格式为密码
android:lines="3"/> 编辑框的行数为3
3、普通按钮:用于触发一个动作
添加单击事件监听器:
如下图:
4、单选按钮:
<RadioGroup
android:id="@+id/radiogroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="一年级"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="二年级"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="三年级 "/>
</RadioGroup>
5、复选框:
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="篮球"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="足球"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="乒乓球"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="羽毛球"/>