I get error when use android:background and item_bg.xml -
i try create selectable listview.
everthing right error when use android:background="@drawable/item_bg"
drawable/item_bg.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:color="#999999"> </item> <item android:state_pressed="true" android:color="#ff00ff"> </item> <item android:state_selected="true" android:color="#b3bdff"> </item> <item android:state_pressed="false" android:color="#000000"> </item> </selector>
error lines:
android.view.inflateexception: binary xml file line #1: error inflating class
caused by: android.content.res.resources$notfoundexception: file res/drawable-hdpi-v4/item_bg
if deleted item tag work not selectable
it solved!
- deleted drawable files! deleted attribute name
- android:background="@drawable/item_bg" created xml again with
- different name!(e.g. item_bg_selector) created colors.xml define
- attibute again (android:background="@drawable...")
it's done!
Comments
Post a Comment