Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无法在ExpandableListView中突出显示所选项目(选择器不工作)_Android_Xml - Fatal编程技术网

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;
        }
    });