在自定义控件中常用属性值有:color、boolean、dimension、float、integer、string、fraction、enum、flag。
1. reference:
属性申明:
<declare-styleable name = "名称">
</declare-styleable>
2.具体属性值定义:
①color:
<attr name = "textColor" format = "color" />
②boolean:
<attr name = "focusable" format = "boolean" />
③dimension:尺寸值:
<attr name = "layout_width" format = "dimension" />
④ float:浮点值:
<attr name = "toAlpha" format = "float" />
⑤integer:整型值。
<attr name = "framesCount" format="integer" />
⑥ string:字符串。
<attr name = "apiKey" format = "string" />
⑦ fraction:百分数。
<attr name = "pivotX" format = "fraction" />
⑧ enum:枚举值。
<attr name="orientation">
<enum name="horizontal" value="0" />
<enum name="vertical" value="1" />
</attr>
⑨ flag:位或运算。
<flag name = "stateUnspecified" value = "0" />