r.styleable 是自定义控件
自定义控件写好的后,需要在
res-value-attrs.xml中定义,如:
1 <declare-styleable name="SlidingMenu"> 2 <attr name="mode"> 3 <enum name="left" value="0" /> 4 <enum name="right" value="1" /> 5 </attr> 6 <attr name="viewAbove" format="reference" /> 7 <attr name="viewBehind" format="reference" /> 8 <attr name="behindOffset" format="dimension" /> 9 <attr name="behindWidth" format="dimension" />10 <attr name="behindScrollScale" format="float" />11 <attr name="touchModeAbove">12 <enum name="margin" value="0" />13 <enum name="fullscreen" value="1" />14 </attr>15 <attr name="touchModeBehind">16 <enum name="margin" value="0" />17 <enum name="fullscreen" value="1" />18 </attr>19 <attr name="shadowDrawable" format="reference" />20 <attr name="shadowWidth" format="dimension" />21 <attr name="fadeEnabled" format="boolean" />22 <attr name="fadeDegree" format="float" />23 <attr name="selectorEnabled" format="boolean" />24 <attr name="selectorDrawable" format="reference" />25 </declare-styleable>