我正在创建自己的Android启动器。
问题是:
我已经能够删除启动动画:
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
launch_intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
activity.startActivity(launch_intent);
我的目标是:
提前致谢!
答案 0 :(得分:5)
我看了一下Android API演示,正如建议您应该使用“overridePendingTransition()”方法,它设置传入活动的动画和传出活动的动画。
该方法应该在startActivity()之后或者在finish()之后添加:
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
activity.startActivity(launch_intent);
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
转换是标准的Android动画,例如zoom_enter将是这样的:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
如果您还想在活动关闭时设置动画,例如当用户按下后退或主页按钮时,您应该将overridePendingTransition()添加到onPause()方法。
如果要在某些其他应用程序启动活动时设置动画,请在super.onCreate()之前添加overridePendingTransition()。
答案 1 :(得分:0)
其实我也认为这是一个恼人的动画,所以我也想改变它........我发现它是 - 它是默认动画.........检查这个链接........ HTTP://developer.android.com/reference/android/view/animation/GridLayoutAnimationController.html 所以我不再寻找这个问题......
答案 2 :(得分:0)
要显示标准启动器动画,您必须为主启动器活动应用特定主题。这个主题应该是(或者应该继承)android:Theme.Wallpaper。
android:theme="@android:style/Theme.Wallpaper"
对于此类主题,Android Framework提供了您可能会在标准Launcher中看到的特定动画。