笔记 - Android - 3.控件属性
2016-03-30 22:05
393 查看
Android:控件
<TextView/>:普通文本标签
<EditText/>:输入框
> android:hint:在输入框控件中起提示作用;
> android:lines:限定输入框的可视行数
> android:maxLength:限定输入框中的可输入字符长度;
> android:inputType:指定输入框的类型
>> textPassword:指定输入框类型为密码框
>> ......
<Button/>:按钮
> android:onClick:指定该按钮的单击事件方法名
<CheckBox/>:复选框
> android:checked:布尔值,指示复选框初始状态
··控件通用属性
android:id:每个控件的唯一标识符;
android:text:控件中显示的文本字符串;
android:textColor:控件中显示的文字的颜色;
android:textSize:控件中字体的大小,单位为sp;
··控件通用布局属性
android:layout_width:控件的宽度
取值:
fill_parent:填充父容器
match_parent:填充父容器,与fill_parent相同
wrap_content:包裹内容,表示控件宽度随内容的宽度变化而变化
android:layout_height:控件的高度
取值:
同宽度
android:layout_above:该控件位置在指定控件的上面
android:layout_below:该控件位置在指定控件的下面
android:layout_toLeftOf:该控件位置在指定控件的左边
android:layout_toRightOf:该控件位置在指定控件的右边
android:layout_margin:上下左右四边外边距
android:layout_marginTop:上外边距
android:layout_marginRight:右外边距
android:layout_marginBottom:下外边距
android:layout_marginLeft:左外边距
android:layout_padding:上下左右四边内边距
android:layout_paddingTop:上内边距
android:layout_paddingRight:右内边距
android:layout_paddingBottom:下内边距
android:layout_paddingLeft:左内边距
<TextView/>:普通文本标签
<EditText/>:输入框
> android:hint:在输入框控件中起提示作用;
> android:lines:限定输入框的可视行数
> android:maxLength:限定输入框中的可输入字符长度;
> android:inputType:指定输入框的类型
>> textPassword:指定输入框类型为密码框
>> ......
<Button/>:按钮
> android:onClick:指定该按钮的单击事件方法名
<CheckBox/>:复选框
> android:checked:布尔值,指示复选框初始状态
··控件通用属性
android:id:每个控件的唯一标识符;
android:text:控件中显示的文本字符串;
android:textColor:控件中显示的文字的颜色;
android:textSize:控件中字体的大小,单位为sp;
··控件通用布局属性
android:layout_width:控件的宽度
取值:
fill_parent:填充父容器
match_parent:填充父容器,与fill_parent相同
wrap_content:包裹内容,表示控件宽度随内容的宽度变化而变化
android:layout_height:控件的高度
取值:
同宽度
android:layout_above:该控件位置在指定控件的上面
android:layout_below:该控件位置在指定控件的下面
android:layout_toLeftOf:该控件位置在指定控件的左边
android:layout_toRightOf:该控件位置在指定控件的右边
android:layout_margin:上下左右四边外边距
android:layout_marginTop:上外边距
android:layout_marginRight:右外边距
android:layout_marginBottom:下外边距
android:layout_marginLeft:左外边距
android:layout_padding:上下左右四边内边距
android:layout_paddingTop:上内边距
android:layout_paddingRight:右内边距
android:layout_paddingBottom:下内边距
android:layout_paddingLeft:左内边距
相关文章推荐
- 笔记 - Android - 2.短信发送器
- Android Studio 前言中不允许有内容 解决办法 assets
- android圆角按钮的实现【新浪云搬运】
- 笔记 - Android - 4000 1.电话拨号器
- Android 使用外部已经建立好的sqlite数据库
- android录音功能的实现【新浪云搬运】
- 【Java】【 Android】中的引用分类和使用
- android省市二级联动的实现【新浪云搬运】
- android 自动初始化控件 不用注解不用findViewByid
- android学习记录
- android 开发文档模板【新浪云搬运】
- android插上耳机仍用扬声器播放音频【新浪云搬运】
- Android学习(3) -- Android虚拟机
- Android中pendingIntent的深入理解
- Xamarin.android Intent传递对象
- android唤醒屏幕并解锁【新浪云搬运】
- Android中ListView分页加载数据
- Android之Intent深入
- 【Android】通用系列 —— 下拉刷新之继承ListView的下拉刷新
- AndroidStudio项目交付(更新)到github最详细步骤