Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change ListView selected colour on Android

So I have a listView on Android which I create in code like so:

setListAdapter(new ArrayAdapter<String>(this, R.layout.menuitem, menuitems));

ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setBackgroundColor(Color.RED);
lv.setOnItemClickListener(new OnItemClickListener() { ... });

Is there a way to change the selection colour in code from the default orange colour to another one?

like image 600
ingh.am Avatar asked Nov 29 '10 14:11

ingh.am


1 Answers

Take a look at: Android ListView Selector Color

like image 84
Peter Knego Avatar answered Sep 30 '22 05:09

Peter Knego