您的位置:首页 > 移动开发 > Android开发

笔记 - 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:左内边距

   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: