Android ListView setSelection() does not seem to work

前端 未结 17 1717
情歌与酒
情歌与酒 2020-11-28 06:45

I have a ListActivity that implements onListItemClick() and calls a doSomething() function of the class. The latter contains l.s

17条回答
  •  眼角桃花
    2020-11-28 07:01

    For me it helped to set
    ListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); or ListView.CHOICE_MODE_MULTIPLE
    then
    ListView.setSelection(position) or ListView.setItemChecked(position, true);
    works fine

提交回复
热议问题