Android ListView setSelection() does not seem to work

前端 未结 17 1692
情歌与酒
情歌与酒 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:14

    setSelection() does not necessarily have visual impact. The selection bar only appears if you use the D-pad/trackball to navigate the list. If you tap on the screen to click something, the selection bar appears briefly and vanishes.

    Hence, setSelection() will only have a visual impact if the activity is not in touch mode (i.e., the last thing the user did was use the D-pad/trackball).

    I am not 100% certain this explains your phenomenon given the description you provided, but I figured it is worth a shot...

提交回复
热议问题