0

Can anyone give me some idea or code if possible regarding how to change the Theme of Listview ( like the back ground color, text color, icons etc) by clicking a button for example at runtime?

I saw an example here android dynamically change style at runtime.

I want to know if something similar is possible for List Views?

Thank You.

Community
  • 1
  • 1
quad
  • 872
  • 3
  • 17
  • 37

2 Answers2

0

For changing the Bg color, you can set it dynamically.

mListView.setBackgroundColor(mColor); //doc

For changing the design in your listView, you have to set some variables, then use them in your custom adapter. When you click, you change these variables and call the notifyDataSetChanged() method. Hope this will help you.

AMerle
  • 4,354
  • 1
  • 28
  • 43
0

If I understand your question correctly, you want to customize the look and feel of the rows (individually or all) dynamically. If so, using a custom adapter and overriding the getView(...) function will probably work for you.

A quick explanation is available at http://www.mkyong.com/android/android-listview-example/

Hope this helps.

Aviral
  • 1,141
  • 1
  • 10
  • 16
  • Hey... I want to change the list view background color, Text color etc when I click on a button. – quad Jul 19 '12 at 08:22