如果选择为黄色,我想将列表视图中的行颜色设置为黄色,否则为白色,因此我使用以下选择器
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true"
android:state_pressed="true" android:drawable="@color/encounter_normal" />
<item android:state_enabled="true"
android:state_focused="true" android:drawable="@color/encounter_normal" />
<item android:state_enabled="true"
android:state_selected="true" android:drawable="@color/encounterselector_color" />
<item
android:drawable="@color/encounter_normal" />
</selector>
在哪里
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="encounterselector_color">#fbeda5</color>
<color name="encounter_normal">#ffffff</color>
</resources>
我像下面这样使用它
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/EncounterGrid"
android:background="@drawable/encounterlistview"
>
<!-- remaining code -->
但是该行总是白色的,知道如何解决这个问题