ListView selection remains persistent after exiting choice mode

后端 未结 11 863
青春惊慌失措
青春惊慌失措 2020-11-29 01:45

I have a ListView subclass that I allow selections on when the context action bar (CAB) is active. The CAB is set as a callback to the onItemLongClick event:

11条回答
  •  佛祖请我去吃肉
    2020-11-29 02:07

    I have found that the only two methods that work here (API 19) are:

    • Resetting the list adapter, which is undesirable because it goes back to the top of the list;
    • Setting the choice mode to CHOICE_MODE_NONE in a new Runnable

    If the choice mode is changed without using listView.post(new Runnable()), it doesn't work. Can anyone explain to me why this is?

    Apologies for not commenting; I have no reputation.

    Thanks.

提交回复
热议问题