Setting alpha transparency at a listView android

user569873 picture user569873 · Jan 27, 2011 · Viewed 9.8k times · Source

Hi i would like to set some transparency to my listview , i've alredy see some examples of that , but all of than were a 100% transparent .

as this topic : 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"

But in my case i just want to make it half transparent , some sort of alpha 50 and stuff. My goal here is that the user could see the background of the UI through listview but also see the background of my listView with a bit of transparecy.

How can i achieve that ?

Thanks.

Answer

fiction picture fiction · Jan 27, 2011

If I recall correctly, first two digits from #00000000 are for alpha channel.

Something like #80XXXXXX will be 50% transparency.

You can refer Color State List for further explanation.