How to make a ListView transparent in Android?

How to make the ListView transparent in android?

The background android screen image should be visible.


Solution 1:

You should use the more verbose

android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent"

Updated with Jacky's response. I originally merely meant to add to his answer, since he was using a plain hex color in the sample.

Solution 2:

android:background="@android:color/transparent" android:cacheColorHint="@android:color/transparent"

Solution 3:

  • How to make the ListView transparent in android?

As Jacky mentioned, setting attributes for list view will do the job.

android:background="#00000000" 
android:cacheColorHint="#00000000"
  • The background android screen image should be visible.

In Android manifest file add following attribute to activity.

android:theme="@android:style/Theme.Dialog"

Solution 4:

This article helps explain the nuances of ListView in conjunction with a custom background - http://developer.android.com/resources/articles/listview-backgrounds.html

tl;dr - put this in the offending ListView's xml somewhere:

android:cacheColorHint="#00000000"

Solution 5:

try this:

list.setCacheColorHint(Color.TRANSPARENT);