Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent layout in Android?

Tags:

android

I am developing one android application which use transparent activity.. I used the following link as reference but my problem is when i set background color as black i am not able see previous. i need transparent like this .

alt text

Thanks in Advance...

like image 219
David Avatar asked Nov 26 '10 14:11

David


People also ask

What is transparent color in Android?

TRANSPARENT (which represents the same thing as @android:color/transparent ) is equal to 0 . The hex representation of 0 is #00000000 , which means that Color. TRANSPARENT is essentially a completely transparent Color.

How do I make Constraintlayout transparent?

If you add this line to the Constraint Layout xml it will become transparent: android:background="@android:color/transparent" . This will make the background see through and show what ever is bellow or overlapping.

Is there a color code for transparent?

You can actually apply a hex code color that is transparent. The hex code for transparent white (not that the color matters when it is fully transparent) is two zeros followed by white's hex code of FFFFFF or 00FFFFFF.


1 Answers

I had requirements to do the same thing in My Application, and I tried the above solution but unfortunately it didn't work for me.

After searching a lot for the same Issue, I have found one another solution That I would like to share here,

I have one Demo.java activity for top and Test.java Activity to show in background..So for that I have created one Style and applied to Demo.java ...and Magic..All Worked.!!

style.xml

<style name="Theme.D1NoTitleDim" parent="android:style/Theme.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:background">@android:color/transparent</item>
</style>

and in Manifest.xml

<activity android:name="Demo"
android:theme="@style/Theme.D1NoTitleDim"></activity>

Hope This will help Others Too. Enjoy Coding.!!

like image 190
Chirag Patel Avatar answered Oct 20 '22 04:10

Chirag Patel