Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.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 SetMultichoiceModelListener未在列表视图中激活_Android_Listview_Multiple Select - Fatal编程技术网

Android SetMultichoiceModelListener未在列表视图中激活

Android SetMultichoiceModelListener未在列表视图中激活,android,listview,multiple-select,Android,Listview,Multiple Select,在我的应用程序中,我希望用户选择多个列表项。为此,我使用了choiceMode=multiple。但当我尝试选择一项时,另一项选择消失了。此外,我的listView.SetMultichoiceModelListener()也没有启动 代码 Xml 如果我从列表中选择了一个项目,则它不会被选中 您可以提供SearchCategories适配器的代码吗?您可以提供SearchCategories适配器的代码吗?您可以提供SearchCategories适配器的代码吗? lvCategories

在我的应用程序中,我希望用户选择多个列表项。为此,我使用了choiceMode=multiple。但当我尝试选择一项时,另一项选择消失了。此外,我的listView.SetMultichoiceModelListener()也没有启动

代码

Xml



如果我从列表中选择了一个项目,则它不会被选中

您可以提供SearchCategories适配器的代码吗?您可以提供SearchCategories适配器的代码吗?您可以提供SearchCategories适配器的代码吗?
lvCategories = (ListView) findViewById(R.id.lv_search_list);
        lvCategories.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);

        rlLoc = (RelativeLayout) findViewById(R.id.rl_search_loc);

        arrCategories = getResources().getStringArray(R.array.search_categories);
        adapter = new SearchCategoriesAdapter(contextActivity, getListData());

        lvCategories.setAdapter(adapter);

        //lvCategories.setItemsCanFocus(false);

        lvCategories.setMultiChoiceModeListener(this); 
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="10dp"
        android:layout_weight="3"
        android:orientation="vertical">

        <TextView
            android:id="@+id/textView5"
            style="@style/text_style"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#50FFFFFF"
            android:gravity="center|start"
            android:hint="select category"
            android:paddingLeft="15dp"
            android:textSize="20sp" />

        <ListView
            android:id="@+id/lv_search_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:layout_marginTop="1dp"
            android:layout_weight="1"
            android:listSelector="@android:drawable/list_selector_background"
            android:divider="#7c7885"
            android:dividerHeight="1dp" />
    </LinearLayout>