I have found this interesting answer about implementing custom drawable states using selectors. I copied the source code and added my activity that use custom button. But it does not work - created buttons are grey. Setters are never called. This should lead to a state when a green item_raw background is used.
Complete code is at GitHub: https://github.com/literakl/DressUp/commit/4357f32773f4dbe15c05a3565e9fa39cdba4cee3
My changes to original answer follow. First is namespace copied from the Manifest's package:
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/sandbox.lelisoft.com.dressup">
Layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<sandbox.lelisoft.com.dressup.FoodButton
android:layout_height="60dp"
android:layout_width="150dp"
app:state_baked="false"
app:state_fried="true"
/>
What silly mistake have I made?