Próbowałem pokazać prostą listę zaznaczoną i potrzebuję niektórych elementów do sprawdzenia.Android ListView :: setItemChecked nie działa
Oto mój kod
ArrayAdapter<Task> taskAdapter = new ArrayAdapter<Task>(this, android.R.layout.simple_list_item_checked, tasksList); this.getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); this.getListView().setItemChecked(2, true); setListAdapter(taskAdapter);
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
I nadal nie działa. Wdrożenie interfejsu Checkable nie pomogło.
Jaka jest sztuczka tego ListView?
Spróbuj ustawić adapter przed 'setItemChecked()' – tbruyelle