attrs.xml檔案中屬性型別format值的格式 .
阿新 • • 發佈:2019-01-29
[java]
view plaincopyprint?
[html] view plaincopyprint?
標誌位、位或運算,格式如下:
[html] view plaincopyprint?
[html] view plaincopyprint?
屬性定義可以指定多種型別:
[html] view plaincopyprint?
[html] view plaincopyprint?
- "reference"//引用
- "color"//顏色
- "boolean"//布林值
- "dimension"//尺寸值
- "float"//浮點值
- "integer"//整型值
- "string"//字串
- "fraction"//百分數,比如200%
"reference" //引用
"color" //顏色
"boolean" //布林值
"dimension" //尺寸值
"float" //浮點值
"integer" //整型值
"string" //字串
"fraction" //百分數,比如200%
列舉型的格式:
- <attrname
- <enumname="horizontal"value="0"/>
- <enumname="vertical"value="1"/>
- < /attr>
< attr name="orientation">
< enum name="horizontal" value="0" />
< enum name="vertical" value="1" />
< /attr>
XML檔案中使用:[html] view plaincopyprint?
- android:orientation =
android:orientation = "vertical"
標誌位、位或運算,格式如下:
[html] view plaincopyprint?
- <attrname="windowSoftInputMode">
- <flagname = "stateUnspecified"value = "0"/>
- <flagname = "stateUnchanged"value = "1"/>
- <flagname = "stateHidden"value = "2"/>
- <flagname = "stateAlwaysHidden"value
- <flagname = "stateVisible"value = "4"/>
- <flagname = "stateAlwaysVisible"value = "5"/>
- <flagname = "adjustUnspecified"value = "0x00"/>
- <flagname = "adjustResize"value = "0x10"/>
- <flagname = "adjustPan"value = "0x20"/>
- <flagname = "adjustNothing"value = "0x30"/>
- < /attr>
< 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檔案中使用:[html] view plaincopyprint?
- android:windowSoftInputMode = "stateUnspecified | stateUnchanged | stateHidden">
android:windowSoftInputMode = "stateUnspecified | stateUnchanged | stateHidden">
屬性定義可以指定多種型別:
[html] view plaincopyprint?
- <attrname = "background"format = "reference|color"/>
< attr name = "background" format = "reference|color" />
XML檔案中使用:[html] view plaincopyprint?
- android:background = "@drawable/圖片ID|#00FF00"