How to change backgroundcolor of clicked row in a single choice listview
I want to create a single choice listview in which when an item is pressed i should be able to change the background color of the item pressed. I have tried setting the backgroundcolor of the view parameter passed to the onItemClick function but this changes开发者_Go百科 the backgrouncolor of someother item. After the background color change i want to make the Listview non clickable. I have tried setting clickable and focusable to false in the onItemClick handler function but that doesnt help. I also want to be able to populate this ListView with new data and then make it clickable again later. I will have only four listviewitems so is it better not to use the listview at all and may be use four buttons.
Thanks
You need to use a stateful drawable. See the question for more details.
精彩评论