自定义属性汇总
文章目录
自定义属性类型
1.reference
- 资源类型
1 | <attr name="backimg" format="reference"/> |
2.color
- 颜色类型
1 | <attr name="textColor" format="color" /> |
3.boolean
- 布尔类型
1 | <attr name="focusable" format="boolean" /> |
4.dimension
- 尺寸类型
1 | <attr name="layout_width" format="dimension" /> |
5.float
- 浮点类类型
1 | <attr name="toAlpha" format="float"/> |
6.integer
- 整数类型
1 | <attr name="visible" format="integer" /> |
7.string
- 字符串类型
1 | <attr name="key" format="string" /> |
8.fraction
- 百分比类型
1 | <attr name="pivotX" format="fraction" /> |
9.enum
- 枚举类型
1 | <attr name="orientation"> |
10.flag
- 标记类型(可以与或运算)
1 | <attr name="mode"> |
注意
属性可以同时指定多个类型值
1 | <attr name="background" format="referce|color" /> |

