只需将此行添加到您的style.xml中即可,在清单文件中定义的应用程序主要样式中添加此行。
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:popupAnimationStyle">@style/Animation</item>
</style>
:
<style name="Animation">
<item name="android:windowEnterAnimation">@anim/your_specific_animation</item>
<item name="android:windowExitAnimation">@anim/your_specific_animation</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:toXScale="1.0"
android:toYScale="1.0" />
在活动中调用动画。 Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.myanimation);
image.startAnimation(animation);//place the syntax in options menu