android xml属性

android xml文件布局各种控件的属性很有用处

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/record"
        android:textColor="#888"
        android:drawableRight="@color/colorPrimaryDark"
        android:text="@string/record"
        android:hint="no data"
        android:singleLine="false"
        android:autoLink="all"
        android:contextClickable="false"
        android:textColorLink="#FF0000"/>

每一个View必须要定义的两个属性是layout_width和layout_height,这两个属性的值只能在”match_parent”、”wrap_content”、”fill_parent”之间选择一种。注意,match_parent和fill_parent实际上是一样的,可以在ViewGroup的内部类LayoutParams中找到定义,其值均为-1(说明:布局文件等xml文件在程序运行时会被解析成对应的java对象)

android:id控件标记,用于动态操作组件

android:textColor 字体的颜色,用#rrggbb,即红绿蓝 各两位数表示

android:text 控件上面的字的内容是什么

android:singleLine
如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如 android:text=”test_ singleLine ” android:singleLine=”true” android:layout_width=”20dp”
将只显示“t…”。
如果不设置singleLine或者设置为false,文本将自动换行

android:autoLink=”all”生成对应的链接,如电话本,邮件
android:linksClickable=”false” 以上生成的链接点击不可弹出

android:textColorLink 链接的颜色这里FF0000为红色

android:drawableRight设置图片

相对布局的属性,主要分为四大类,如下图

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值