1. reference:参考某一资源ID。 (1)属性定义: 1 c: g+ L& j r) j<declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable> * k$ S' r- [! g: E0 ~(2)属性使用: <ImageView android:layout_width = "42dip"8 U; W8 T T& H0 ~* X; X /> ; g/ n" P, K) Y& M3 F2. color:颜色值。 (1)属性定义: 8 F ~; \" s8 X3 K4 K7 f' Y5 V' v<declare-styleable name = "名称"> <attr name = "textColor" format = "color" /> </declare-styleable> (2)属性使用: <TextView android:layout_width = "42dip"! y$ @/ F- U( V- L! A /> 3. boolean:布尔值。 - K1 _1 J4 k- N3 \(1)属性定义: 8 ~9 t! V& O6 ~1 s7 H8 P6 r$ I2 p7 u<declare-styleable name = "名称"> <attr name = "focusable" format = "boolean" /> </declare-styleable> (2)属性使用: " _- S& P/ ` G$ P1 L0 ~( r<Button android:layout_width = "42dip" android:focusable = "true" /> 4. dimension:尺寸值。 7 y& d2 X& x) W: C$ P(1)属性定义: <declare-styleable name = "名称"> <attr name = "layout_width" format = "dimension" /> </declare-styleable> # v# L' ? J$ V* J(2)属性使用: 5 T6 ]3 ]( `+ C4 Z6 `<Button android:layout_width = "42dip"- ?; r7 P# ], i$ ~ /> 5. float:浮点值。 7 }; j7 }# [! L6 F* o0 k4 y(1)属性定义: <declare-styleable name = "AlphaAnimation"> <attr name = "fromAlpha" format = "float" />) K" X% W! `. u0 O( I& b </declare-styleable> (2)属性使用: <alpha /> 6. integer:整型值。 7 t$ X& I9 R7 s5 J5 Q! B: |(1)属性定义: . _& x) A, i( o; x, k<declare-styleable name = "AnimatedRotateDrawable"> <attr name = "visible" />1 F1 E# r9 k: A4 c </declare-styleable> 0 D M+ A5 F' D/ C+ q6 S' R(2)属性使用: 9 ?. x7 C8 K& o% j! K% j K# N<animated-rotate xmlns:android = "http://schemas.android.com/apk/res/android" /> 4 g" D3 g( _$ Z7 }0 w8 G/ Q7. string:字符串。 (1)属性定义: ' ] m6 W# P/ ]! X Z; G" n* l. w <declare-styleable name = "MapView"> (2)属性使用: <com.google.android.maps.MapView /> 0 F& U: h$ w- }: A3 {8. fraction:百分数。 (1)属性定义: 5 g* R8 ^' z0 E <declare-styleable name="RotateDrawable"> (2)属性使用: <rotate xmlns:android = "http://schemas.android.com/apk/res/android" android:fromDegrees = "0" android:pivotX = "200%" android:pivotY = "300%" android:repeatMode = "restart" android:repeatCount = "infinite" /> 9. enum:枚举值。 (1)属性定义: <declare-styleable name="名称">; |7 ^1 L1 ^* m" `" J8 o H' r$ j, x </declare-styleable> (2)属性使用: <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" 10. flag:位或运算。 " O3 A. S) `: O% G(1)属性定义: <declare-styleable name="名称"> </declare-styleable> (2)属性使用: <activity android:name = ".StyleAndThemeActivity" 注意: 8 \' X' @6 z" b3 F6 l6 q% X: e7 G属性定义时可以指定多种类型值。 ! E) N0 d# s! f& F: @9 Z(1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference|color" /> </declare-styleable> / V: ~0 _) w3 r" j$ X' n(2)属性使用: 4 Y! t0 K: o! J% B9 O8 _% d( ~- X+ q" \<ImageView android:layout_width = "42dip" /> |