How to Make a Listview Transparent in Android

Transparent divider in a listview

Try this:

color.xml: (res > values > color.xml)

<?xml version="1.0" encoding="utf-8"?>
<resources>
<drawable name="transperent_color">#00000000</drawable>
</resources>

Now,use it like:

setListAdapter(new ArrayAdapter<String>(this,R.layout.news,news));
ListView lv=getListView();
lv.setDivider(this.getResources().getDrawable(R.drawable.transperent_color));
lv.setDividerHeight(20);

Can't make ListView Background transparent in Android 2.2

Question necromancy (i was having the same issue and googling):

The answer may be in this question, i.e. also set listSelector to make the focus color transparent.

Android: Transparent Colored ListViews with Background

Add following property in ListView...

android:cacheColorHint="#00000000"

it is for transparent background of ListView.
More detail see Here.



Related Topics



Leave a reply



Submit