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 .
Thanks in Advance...
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.
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.
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.
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.!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With