触摸项目时,应更改颜色。我做不到。谁能告诉我该怎么办?
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:background="#fff200"
android:listSelector="@drawable/list_item_selector"
android:drawSelectorOnTop="true"
/>
list_item_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/selector_focus" />
<item android:drawable="@android:color/transparent"/>
</selector>
selector_focus.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:endColor="#fff47902" android:startColor="#fff62c0f" android:angle="90"></gradient>
</shape>