I am having a small problem with the list-view? If the item is selected in the listview that row color should be changed?
Asked
Active
Viewed 219 times
0
-
1you can't demand here. Read StackOverflow FAQ – Paresh Mayani Oct 12 '11 at 11:28
2 Answers
1
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
// TODO Auto-generated method stub
view.setBackgroundColor(Color.CYAN);
}

Rasel
- 15,499
- 6
- 40
- 50
-
sry i need through selectors. if the item is selected means it should be gray else the color should be transparent – NikhilReddy Oct 12 '11 at 11:20
-
2@gujjulanikhilreddy If it works, mark this answer as accepted by clicking the tick mark to the left. You'll get some reputation in return! – fredley Oct 12 '11 at 11:24
0
set itemclicklistener for the list.Then in onitemclicklistener set the color for the view
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
view.setBackgroundColor(Color.RED);
}
visit this site http://www.vogella.de/articles/AndroidListView/article.html and scroll to Single vrs. Multiselection It uses checkbox in listview .Follow similar process to set background color when selected and when not selected

kehnar
- 1,387
- 2
- 12
- 25