Android 无法在ExpandableListView中突出显示所选项目(选择器不工作)
我有以下代码Android 无法在ExpandableListView中突出显示所选项目(选择器不工作),android,xml,Android,Xml,我有以下代码 <ExpandableListView android:id="@+id/navigationMenuList" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginTop="10dp" android:listSelect
<ExpandableListView
android:id="@+id/navigationMenuList"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:listSelector="@drawable/expandable_menu"
android:choiceMode = "singleChoice">
</ExpandableListView>
我试过很多不同的方法,但都不管用。正在工作的东西仅处于按下状态
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:drawable="@android:color/holo_blue_bright" android:state_pressed="true" />
<item android:drawable="@android:color/holo_blue_light" android:state_selected="true" />
<item android:drawable="@android:color/holo_blue_dark" android:state_activated="true" />
</selector>
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView expandableListView, View view, int i, int i1, long l) {
int index = expandableListView.getFlatListPosition(ExpandableListView.getPackedPositionForChild(i,i1));
expandableListView.setItemChecked(index,true);
Toast.makeText(getApplicationContext(),drawableMenuListAdapter.getChild(i,i1).toString(),Toast.LENGTH_SHORT).show();
return true;
}
});