android - Cannot reference an xml-drawable from a style -


i'm trying specify reference/resource-id drawable custom style.

if drawable image file (ie, .png), ok, if drawable xml layout file (ie, selector), compile-time error:

no resource found matches given name (at 'net.monocross.app:button_drawable_id' value '@layout/xmlselector') ..\resources\values\styles.xml

i'm trying determine if android rule, or maybe monodroid issue, , if there other means end ?

thanks.

styles.xml

<style name ="dropdownbuttona">   <item name="android:layout_width">@dimen/button_width</item>   <item name="android:layout_height">@dimen/button_height</item>   <item name="net.monocross.app:button_label_text">hi</item>   <item name="net.monocross.app:button_label_color">#99abcdef</item>    <!-- ok -->    <item name="net.monocross.app:button_drawable_id">@drawable/pngimage</item>    <!-- error -->   <item name="net.monocross.app:button_drawable_id">@drawable/xmlselector</item>  </style> 

attrs.xml

<declare-styleable name="dropdownbutton">   <attr name="button_label_text" format="string"></attr>   <attr name="button_label_color" format="color"></attr>     <attr name="button_drawable_id" format="reference"></attr> </declare-styleable> 

i needed rename xml-drawable file

xmlselector.axml -> xml_selector.xml

if doesn't work you, try keeping .axml extension.


Comments