How to make ListView transparent in Android?

How to make ListView transparent in android?

The Android background image should be visible.

+64
android android-layout android-listview
04 Sep '09 at 5:11
source share
11 answers

You should use more detailed

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

Updated with Jackie's answer. I initially just wanted to add to his answer, since he used a simple hex in the sample.

+122
Sep 07 '09 at 7:49
source share

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

+60
Sep 04 '09 at 9:46
source share
  • How to make ListView transparent in android?

As Jackie said, setting attributes to view the list will do the job.

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

In the Android manifest file, add the following attribute to the activity.

 android:theme="@android:style/Theme.Dialog" 
+13
Sep 04 '09 at 2:00
source share

try the following:

 list.setCacheColorHint(Color.TRANSPARENT); 
+5
Aug 31 '12 at 10:22
source share

Add this so the list items remain transparent when clicked:

 android:listSelector="@android:color/transparent" 
+5
Sep 10 '12 at 11:50
source share

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

tl; dr - put this in an abusive ListView xml somewhere:

android:cacheColorHint="#00000000"

+4
Sep 12 '11 at 18:51
source share

If you want to use partial transparency, this will help you when setting up color codes.

2 hexadecimal characters can be added to any hexadecimal color code. The first 2 characters in an 8-digit hexadecimal color code represent its opacity in Android.

Two hexadecimal characters can range from 00 to FF. For example -

  • Normal opaque black hex- "# 000000"
  • Fully transparent black - "# 00000000"
  • Completely opaque black - "# FF000000"
  • 50% transparent black - "# 80000000"

Thus, you can change any color to any level of transparency.

Source- http://zaman91.wordpress.com/2010/03/22/android-how-to-create-transparent-or-opeque-background/

+3
May 30 '13 at 8:19
source share

You can use these

 android:background="@android:color/transparent" android:listSelector="@android:color/transparent" 
+2
Sep 19 '13 at 11:00
source share

The answers above will work, but it is likely that when you scroll through the ViewView list, it will be darkened, as in this case: the problem with the android list with transparent cells

To solve this problem, you can use cacheColorHint as described above, but if you add ListView dynamically (from code, not xml), then this will not work. You are forced to declare a ListView in XML, dunno if this is an error or something else.

+1
Nov 21 '11 at 16:38
source share

try the following:

 android:cacheColorHint="@null" 
+1
Nov 24 '12 at 3:18
source share

Check this blog.

[http://aboutyusata.blogspot.in/2013/10/how-to-make-listview-with-transparent.html] [1]

or

 android:background="@android:color/transparent" 
0
Jan 08 '14 at 7:36
source share



All Articles