Clear SingleChoice ListView selection

后端 未结 5 1515
迷失自我
迷失自我 2020-12-29 10:13

Is there a way to clear the selected item in a ListView?

The ListView is defined like this:



        
5条回答
  •  自闭症患者
    2020-12-29 10:38

    It's an old question, but just in case someone else needs it in the future, based on @Cheesebaron answer, here's what I did:

    On each ListViews' OnItemClickListener set the other's list checked item to false:

    list1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView parent, View view, int pos, long id) {
                list2.setItemChecked(list2.getSelectedItemPosition(), false);
            }
    });
    

    This implementation is in Java, but if you get the logic here you can implement it in C# as well. Hope this helps.

提交回复
热议问题