17

I have the folowing layout:

enter image description here

I want to make transparent the transparent_layout but i can't do it.

Already tried settings the background programmatically with the color: Color.TRANSPARENT but it seems it doesnt work.

Im using Android 2.3.3 SDK with SherlockActionBar.

Is there any way to set that layout to transparent?

Narendra Singh
  • 4,501
  • 5
  • 35
  • 78
alxsimo
  • 537
  • 1
  • 6
  • 18

3 Answers3

46

Depending upon the degree of opacity you like, set the background color like

        android:background="#00ffffff"

The first two digits are for opacity level, (aka alpha) that varies from 00 to ff (fully-transparent to fully-opaque), the remaining digits are for the desired background color. If you keep first 2 digits zero (00), then whatever color you choose for the remaining digits, doesn't matter.

AplusKminus
  • 1,381
  • 1
  • 18
  • 30
Narendra Singh
  • 4,501
  • 5
  • 35
  • 78
6

In XML change the main layout's (LinearLayout) background as android:background="@android:color/transparent" and also make sure that you are not giving the background to any of its child views.

SiHa
  • 6,756
  • 12
  • 30
  • 41
bakriOnFire
  • 2,609
  • 1
  • 14
  • 25
  • you can give it a try [How to create Transparent Activity in Android?](http://stackoverflow.com/a/2700683/2310673) – bakriOnFire May 08 '13 at 16:57
5

Try this:

android:background="@android:color/transparent"
DroidBender
  • 7,577
  • 4
  • 26
  • 37