Change ListView Item Background on click - Android

前端 未结 3 765
陌清茗
陌清茗 2020-12-20 09:24

I\'ve prepared a custom listview using BaseAdapter. Now I want to change color of selected item of listview on click event. And multiple items should be selected. Here I am

3条回答
  •  失恋的感觉
    2020-12-20 09:35

    "Thanks a lot for your help. I've done all this. Now I found that when I click one item in list, another item is also get selected automatically. Is there any problem with BaseAdapter?"

    For this problem you need to save states of your listview rows that whether that row is selected or not in getview check if it is selected then set color of row as selected. You need to save state also whenever you select or deselect any row. Here is a similar example instead of checkbox, row will be there in your case... Hope it will help you i am giving you a link ....

    How to implement a button that gets all checkbox's state and adds the value of checked item into arraylist?

提交回复
热议问题