How to make an Activity transparent over another Activity?
<style name="Theme.CustomTranslucent" parent="android:style/Theme.Translucent">
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:background">@android:color/transparent</item>
</style>
In my activity 2 layout, I could eihter set android:background="@android:color/transparent" or not set any value at all to make it work.
Refer:
http://stackoverflow.com/questions/10481277/translucent-activity-filling-the-entire-screen
<style name="Theme.CustomTranslucent" parent="android:style/Theme.Translucent">
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:background">@android:color/transparent</item>
</style>
In my activity 2 layout, I could eihter set android:background="@android:color/transparent" or not set any value at all to make it work.
Refer:
http://stackoverflow.com/questions/10481277/translucent-activity-filling-the-entire-screen
Incase of AppcompatActivity:
<style name="Theme.AppCompat.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>
Add the following line in <activity> in AndroidManifest.xml
android:theme="@style/Theme.CustomTranslucent"
Refer:
http://stackoverflow.com/questions/20862258/android-how-to-get-appcompat-translucent-type-theme-with-support-actionbar
=====================================
=====================================
How to kill the particular Activity before start to another activity. (Rid the problem of Logout---> MainActivity---> app close)?
Intent next = new Intent(getApplicationContext(),MainActivity.class);
next.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_
SINGLE_TOP);
startActivity(next);
finish();
Result:
Logout---> App Close
=================================
How to make an Activity as Dialog in android?
<style name="AppDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:background">@android:color/transparent</item>
</style>
================================
Comments
Post a Comment