Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - When opening activity the opener disappear before the transition animation ends [duplicate]

I want to create a transparent Activity on top of another activity.

How can I achieve this?

like image 904
UMAR-MOBITSOLUTIONS Avatar asked Nov 17 '25 21:11

UMAR-MOBITSOLUTIONS


1 Answers

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>

(The value @color/transparent is the color value #00000000 which I put in the res/values/color.xml file. You can also use @android:color/transparent in later Android versions.)

Then apply the style to your activity, for example:

<activity android:name=".SampleActivity" android:theme="@style/Theme.Transparent">
...
</activity>
like image 175
gnobal Avatar answered Nov 19 '25 11:11

gnobal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!