- 2
- 0
- 约6.66千字
- 约 7页
- 2016-02-24 发布于江苏
- 举报
Android attr中format属性.doc
Android自定义属性,attr format取值类型
分类: android 2011-11-21 16:10 131人阅读 评论(0) 收藏 举报
?
1. reference:参考某一资源ID。
??? (1)属性定义:
??????????? declare-styleable name = 名称
?????????????????? attr name = background format = reference /
??????????? /declare-styleable
????(2)属性使用:
???????????? ImageView
???????????????????? android:layout_width = 42dip?????????????????????android:layout_height = 42dip???????????????????? android:background = @drawable/图片ID
???????????????????? /
2. color:颜色值。
????(1)属性定义:
??????????? declare-styleable name = 名称
?????????????????? attr name = textColor format = color /
??????????? /declare-styleable
??? (2)属性使用:
??????????? TextView
???????????????????? android:layout_width = 42dip?????????????????????android:layout_height = 42dip???????????????????? android:textColor = #00FF00
???????????????????? /
3. boolean:布尔值。
??? (1)属性定义:
??????????? declare-styleable name = 名称
?????????????????? attr name = focusable format = boolean /
??????????? /declare-styleable
????(2)属性使用:
??????????? Button
??????????????????? android:layout_width = 42dip??????????????????? android:layout_height = 42dip
??????????????????? android:focusable = true
??????????????????? /
4. dimension:尺寸值。
??? (1)属性定义:
??????????? declare-styleable name = 名称
?????????????????? attr name = layout_width format = dimension /
??????????? /declare-styleable
????(2)属性使用:
??????????? Button
??????????????????? android:layout_width = 42dip??????????????????? android:layout_height = 42dip
??????????????????? /
5. float:浮点值。
??? (1)属性定义:
??????????? declare-styleable name = AlphaAnimation
?????????????????? attr name = fromAlpha format = float /?????????????????? attr name = toAlpha format = float /
??????????? /declare-styleable
????(2)属性使用:
??????????? alpha?????????????????? android:fromAlpha = 1.0?????????????????? android:toAlpha = 0.7
?????????????????? /
6. integer:整型值。
??? (1)属性定义:
??????????? declare-styleable name = AnimatedRotateDrawable
?????????????????? attr name = visible /
原创力文档

文档评论(0)