Hellow, I\'m trying to create the translucent Activity and define the code in styles.xml but i\'m unable to make my activity Translucent. how can i make it translucent can a
Add the following style In your res/values/styles.xml file (if you don’t have one, create it.) Here’s a complete file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
Now apply the style to your activity in the manifest
<activity
android:name=".MainActivity"
android:theme="@style/Theme.Transparent">
...
</activity>
Apply this theme to the required Activity
<style name="Theme.TransparentInfo" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/semiTransparentBlack</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
value for @color/semiTransparentBlack is #00000000