Clear SingleChoice ListView selection

后端 未结 5 1518
迷失自我
迷失自我 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:24

    Using listView.SetItemChecked(-1, true); works fine here.

    Here is my Activity I tested with:

    SetContentView(Resource.Layout.Main);
    var listView = FindViewById(Resource.Id.listView);
    _listAdapter = new CustomListAdapter(this);
    listView.Adapter = _listAdapter;
    
    var button = FindViewById

    Main.axml:

    
    
      
      

提交回复
热议问题