Android listitem状态无法与导航抽屉一起使用?

Android listitem状态无法与导航抽屉一起使用?,android,android-layout,android-listview,Android,Android Layout,Android Listview,我正在为我的android应用程序使用导航抽屉。我正在使用listview显示导航抽屉中的项目。我想为listview使用Listitem状态颜色,但它不起作用,并且不会为不同的状态显示不同的颜色。我的代码是: 导航\u drawer.xml <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawe

我正在为我的android应用程序使用导航抽屉。我正在使用listview显示导航抽屉中的项目。我想为listview使用Listitem状态颜色,但它不起作用,并且不会为不同的状态显示不同的颜色。我的代码是:

导航\u drawer.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- The navigation drawer -->

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="280dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@drawable/navigation_item_selector"
        android:cacheColorHint="#00000000"
        android:choiceMode="singleChoice"
        android:divider="@color/side_navigation_list_divider_color"
        android:dividerHeight="1dp" />

</android.support.v4.widget.DrawerLayout>
    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
    <item android:drawable="@color/gray_back" android:state_pressed="true"/>
    <item android:drawable="@color/red" android:state_activated ="true" android:state_selected="true"/>
    <item android:drawable="@drawable/abs__ab_solid_light_holo"/>

</selector>

navigation\u item\u selector.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- The navigation drawer -->

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="280dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@drawable/navigation_item_selector"
        android:cacheColorHint="#00000000"
        android:choiceMode="singleChoice"
        android:divider="@color/side_navigation_list_divider_color"
        android:dividerHeight="1dp" />

</android.support.v4.widget.DrawerLayout>
    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
    <item android:drawable="@color/gray_back" android:state_pressed="true"/>
    <item android:drawable="@color/red" android:state_activated ="true" android:state_selected="true"/>
    <item android:drawable="@drawable/abs__ab_solid_light_holo"/>

</selector>