PopupWindow Enter Exit Animation not working on Marshmallow (23)
Asked Answered
I

1

6

I have set Enter/Exit animation style for PopupWindow like this

 mPopupWindow.setAnimationStyle(R.style.PopupAnimation);

and style as

<style name="PopupAnimation" parent="Widget.AppCompat.PopupWindow">
    <item name="android:windowEnterAnimation">@anim/popup_show</item>
    <item name="android:windowExitAnimation">@anim/popup_hide</item>
</style>

So , when PopupWindow show/hide it has animations which works fine with Lollipop and all previous android versions. But with Marshmallow the popup shows up after the animation time interval and no animation effects.

anim/popup-show.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:interpolator="@android:anim/accelerate_interpolator"
    android:duration="1000"/>
</set>

anim/popup-hide.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="1.0"
    android:toAlpha="0"
    android:interpolator="@android:anim/accelerate_interpolator"
    android:duration="1000"/>
</set>
Interradial answered 31/10, 2015 at 1:38 Comment(2)
Try this: #25399219Collative
Did you ever figure this out? Same issue here.Transmit
T
1

I know this is an old question, but for new readers:

The issue might not be your code, styles, or animations.

If you're confident in your work, try cleaning and rebuilding your projects, restarting your computer and Android device, and deleting any old versions of your app from your Android device before running your latest build.

I had this exact issue where it worked fine on a Lollipop device but not on a newer one. After a day spent trying to fix it in vain, the next morning it just randomly started working. I thought the problem was solved, but when I then adjusted the duration of the animation, I found that it wasn't being reflected on the Android device. Deleting the old version of the app from the device before uploading the new version was the only thing that would make the changes stick.

Transmit answered 4/11, 2021 at 16:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.