前端之家收集整理的这篇文章主要介绍了
attrs.xml文件中属性类型format值的格式,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
"reference"
"color"
"boolean"
"dimension"
"float"
"integer"
"string"
"fraction"
枚举型的格式:
<attr name="orientation">
<enum name="horizontal" value="0" />
<enum name="vertical" value="1" />
</attr>
XML文件中使用:
android:orientation = "vertical"
标志位、位或运算,格式如下:
<attr name="windowSoftInputMode">
<flag name = "stateUnspecified" value = "0" />
<flag name = "stateUnchanged" value = "1" />
<flag name = "stateHidden" value = "2" />
<flag name = "stateAlwaysHidden" value = "3" />
<flag name = "stateVisible" value = "4" />
<flag name = "stateAlwaysVisible" value = "5" />
<flag name = "adjustUnspecified" value = "0x00" />
<flag name = "adjustResize" value = "0x10" />
<flag name = "adjustPan" value = "0x20" />
<flag name = "adjustNothing" value = "0x30" />
</attr>
XML文件中使用:
android:windowSoftInputMode = "stateUnspecified | stateUnchanged | stateHidden">
属性定义可以指定多种类型:
<attr name = "background" format = "reference|color" />
XML文件中使用:
android:background = "@drawable/图片ID|#00FF00"