I\'m defining a custom attribute in XML that is an enum.It looks something like this:
Just define the attribute outside of your control:
<attr name="myProperty" format="enum">
<enum name="None" value="0"/>
<enum name="One" value="1"/>
<enum name="Two" value="2"/>
<enum name="Three" value="3"/>
<enum name="Four" value="4"/>
<enum name="Five" value="5"/>
<enum name="Six" value="6"/>
<enum name="Seven" value="7"/>
<enum name="Eight" value="8"/>
<enum name="Nine" value="9"/>
<enum name="Ten" value="10"/>
</attr>
Then just reuse that for all of your controls:
<declare-styleable name="MyControl">
<attr name="myProperty"/>
</declare-styleable>
<declare-styleable name="MyUnrelatedControl">
<attr name="myProperty"/>
</declare-styleable>