Changing the background colour or Image of a ListActivity!!

Well , I was stuck for like three hours trying to figure out how to change the background of a ListActivity because I have used an adapter with a layout for each item so when I change the background at the layout, only the item’s background is changed, but at the end I figured that it was very easy, here is how I did it : inside your onCreate() preferably before setting any adapters or putting any views, you insert the following line :

getListView().setBackgroundResource("your Image");

This should do the trick .
Hope it helps!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s