Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PopupWindow Enter Exit Animation not working on Marshmallow (23)

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>
like image 375
Libin Avatar asked Oct 31 '15 01:10

Libin


1 Answers

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.

like image 131
Anthony Avatar answered Nov 05 '22 13:11

Anthony