Hi all. My list view is a multiple selection list view. i have to show the selected list view items in one color(say green) and the other items in some other color(red). How to achieve this?
+1
A:
Hi,
It depends what you mean by showing "items in [...] color." The easiest way to change items' colors is to do it in the Adapter's getView() or bindView() method.
Romain Guy
2010-03-08 06:29:20
A:
In the onItemSelectListner change the item background to whichever you need.
Karan
2010-03-08 06:31:06
THe problem with this (and Rowno's similar comment) is that you need to keep track of this state for example when you rotate the screen. Better to store it as a property in the underlying data set and render the list item appropriately, as Romain Guy mentions.
Christopher
2010-03-09 20:43:29
As far as I understand, you want the user to select multiple items and change its color. And I think doing this in the getView() and bindView() won't fully solve your problem. These methods are called when the view gets added to the view.
Karan
2010-03-10 04:49:45
A:
You could call the setBackgroundColor() method in the select event to change the background color.
Rowno
2010-03-08 06:35:29