Setting alpha transparency in a listView control

Hi, I would like to set transparency on my list, I mean some examples of this, but they were all 100% transparent.

like this section: 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" 

But in my case, I just want to make it half transparent, a kind of alpha-50 and so on. My goal here is that the user could see the background of the interface through listview, but also see the background of my listView with few transactions.

How can i achieve this?

Thanks.

+4
source share
3 answers

If I remember correctly, the first two digits from #00000000 refer to the alpha channel.

Something like #80XXXXXX will be 50% transparent.

You can refer to the Color State List for further explanation.

+12
source

You can program the transparency level of the user interface element.

yourUIElement.setAlpha (0.5) makes it 50% transparent.

The setAlpha method takes a value from 0 to 1
0: completely transparent
1: Completely opaque.

+5
source

Colors are expressed in the ARGB color space, therefore # 336699CC:

transparency 0x33 0x66 red component 0x99 green component 0xcc blue component

+3
source

Source: https://habr.com/ru/post/1337377/


All Articles