Android: Transparent Colored ListViews with Background
Asked Answered
K

3

3

I have a doubt I have a listview and below it there is a background with a image. I would like to have the lists with a transparent color in order to see the image in the background with the ListViews color. I have tried using a selector but it just applies to the select item i the listview. Maybe it is not very clear so for that purpose I attach the following picture where the listview and the background is shown: http://www.ingens-networks.com/blog/image.axd?picture=2012%2f4%2fdevice-2012-04-27-132332.png

As you can see the item background is with color but the image is still visible

Thank you very much

Kylakylah answered 15/5, 2013 at 8:39 Comment(2)
Have you tried creating a Custom list item?Marcellemarcellina
#1377836Hyatt
B
4

Add following property in ListView...

android:cacheColorHint="#00000000"

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

Beginning answered 15/5, 2013 at 8:57 Comment(1)
Thanks, used your asnwer as well as this one #11286461Kylakylah
C
0

You can also use an image editor to edit the opacity of the image/shape/gradient/whatever that you're using for the rows. I use Gimp because it's free. Here's what you need to do in Gimp: Go to the 'Layers - Brushes' window. Right-click the image layer and 'Add Alpha Channel'. Then just dial down the Opacity using the number picker (located above the layer) and File -> Export the image. Add this image to your project. Set it as the background for the List View rows. Then set the background for the List View itself to whatever you want to take up the entire background behind the List View.

Campuzano answered 14/8, 2014 at 20:42 Comment(0)
O
0

I managed to achieve this with the RecyclerView by adding this line of code to the 'onBindViewHolder' method in the 'RecyclerView.Adapter' class:

((RelativeLayout) holder.itemView).getChildAt(0).setBackgroundColor(Color.parseColor("#00FFFFFF"));

Bear in mind that the view returned by the above cast expression is an 'android.support.v7.widget.CardView' that contains the list item layout

Orndorff answered 14/7, 2016 at 8:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.