tag requires a 'drawable' attribute or child tag defining a drawable
エラーが出る方
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:color="@color/color_focused" /> <item android:state_pressed="true" android:state_enabled="false" android:color="@color/color_pressed" /> <item android:state_enabled="false" android:color="@color/color_disable" /> <item android:state_active="true" android:color="@color/color_enable" /> <item android:color="@color/color_normal"/> </selector
itemの中にcolorを書いていたので、
itemとcolorを分離した。
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- focus --> <item android:state_focused="true"> <color android:color="@color/color_focused" /> </item> <!-- press --> <item android:state_pressed="true" android:state_enabled="false"> <color android:color="@color/color_pressed" /> </item> <!-- diable --> <item android:state_enabled="false"> <color android:color="@color/color_disable" /> </item> <!-- enable --> <item android:state_active="true"> <color android:color="@color/color_enable" /> </item> <!-- default --> <item> <color android:color="@color/color_normal"/> </item> </selector>
Android LinearLayout with color resource: What am I doing wrong? - Stack Overflow