mardi 28 juin 2022

Android - List View `CHOICE_MODE_SINGLE` not working

Thanks in advance to resolve this issue with android list view. This is the row of the list view adapter.

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:weightSum="13"
        android:orientation="horizontal"
        android:layout_marginStart="20dp">

        <CheckBox
            android:id="@+id/chkId"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <TextView
            android:id="@+id/row_que_status"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="1dip"
            android:layout_weight="2"
            android:gravity="start"
            android:text="que_status"
            android:textAppearance="?android:attr/textAppearanceSmall" />

</LinearLayout>

And I have added the list view in fragment layout

    <ListView
       android:id="@+id/studentList"
       android:layout_height="match_parent"
       android:layout_width="match_parent"
       android:choiceMode="singleChoice">
    </ListView>

And also in my fragment I have set the mStudentListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); to disable the multiple selection of the list view.

But both options not working.




Aucun commentaire:

Enregistrer un commentaire