How can I reference a drawable class in Android XML
- by James Veenstra
I've created a class that extends drawable that I'd like to reference inside a resource xml. I happen to need it in a selector, like so:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_pressed="false"
android:drawable="com.sample.android.contacts.TopBarCollapsed"
/>
<item android:state_window_focused="true" android:state_pressed="true" android:drawable="@drawable/top_switcher_collapsed_selected" />
<item android:state_focused="true" android:drawable="@drawable/top_switcher_collapsed_focused" />
com.sample.android.contacts.TopBarCollapsed is the class that extends drawable.