Android ListView选择器无法正常工作

时间:2013-11-24 19:02:30

标签: android android-listview

触摸项目时,应更改颜色。我做不到。谁能告诉我该怎么办?

<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>

0 个答案:

没有答案