Tuesday, 26 January 2021

How to use standard enter / exit animation transition for activities when using windowIsTranslucent in true?

I have a specifix view that needs to use windowIsTranslucent = true. This generates some problems that I'm having hard time to understand... the specific one that I'm trying to resolve now is why the transition in/out changes to slide up / down only because of this style.

I want to use windowIsTranslucent = true but with the standard activity transition animation.

These are relevant styles

<style name="AppTheme.AppCompat.Translucent" parent="AppTheme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@color/opacity_background</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
</style>


<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">#07819A</item>
    <item name="android:actionMenuTextColor">@color/White</item>
    <item name="android:windowDisablePreview">true</item>
    <item name="colorPrimary">#07819A</item>
    <item name="colorPrimaryDark">#006471</item>
    <item name="android:fastScrollTextColor">#ffffff</item>
    <item name="android:dropDownListViewStyle">@style/FilterSpinnerStyle</item>
    <item name="android:actionOverflowButtonStyle">@style/AppTheme.OverFlow</item>
    <item name="android:autofilledHighlight">@android:color/transparent</item>
</style>   

What I have tried witout success:

Added this line to AppTheme.AppCompat.Translucent

<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>

Added this line to AppTheme.AppCompat.Translucent

<item name="android:windowAnimationStyle">@+android:style/Animation.Activity</item>

Used CurrentActivity.OverridePendingTransition(someId, someId); and it works. The problem is that animation is a little laggy when I try to mimic standard animation and I also have the problem to use the correct animation for each version of Android.

I tried some other things that I don't have at the top of my head right now... the thing is that nothing seems to be enough :(



from How to use standard enter / exit animation transition for activities when using windowIsTranslucent in true?

No comments:

Post a Comment