Android的 - 淡出动画闪屏
我要添加淡出动画我闪屏,虽然最后,我希望把淡出动画效果的闪屏。
I want to add fadeout animation for my splash screen, that is while closing the splash screen I want to bring the fadeout animation effect.
下面是codeS,我都试过了。
Here are the codes which I have tried.
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
但上面只能从2.0使用。尹恩惠的应用程序应该支持1.5。
But the above can be used only from 2.0. Ny app should support from 1.5.
所以我设置下面的动画我的主要活动。
So I have set the following animation for my main activity.
getWindow().setWindowAnimations(android.R.style.Animation_Toast);
或
getWindow().setWindowAnimations(R.style.Theme_FadeIn);
我的Theme.FadeIn包含
My Theme.FadeIn contains
<style name="Theme.FadeIn">
<item name="android:windowNoTitle">true</item>
<item name="android:activityOpenEnterAnimation">@anim/fade_in</item>
</style>
现在我可以看到淡入效果,但我可以看到blackscreen。
Now I can see the fadein effect, but I can see the blackscreen.
如何获取淡入或淡出效果,而不blackscreen。
How to get this fadein or fadeout effect without blackscreen.
谁能帮我尽快解决这个问题?
Can anyone help me to solve this asap?
在此先感谢。
如果您使用的是闪屏独立的活动,你可以做你已经注意到可在安卓2+只有overridePendingTransition电话。您可以选择那些专为2+做过渡和previous版本根本就默认过渡的应用程序:
If you're using a separate Activity for your splash screen, you can do the overridePendingTransition call that you've noted is available in Android 2+ only. You can choose to have apps that are built for 2+ do the transition and previous versions simply do the default transition:
try {
Method method = Activity.class.getMethod("overridePendingTransition", new Class[]{int.class, int.class});
method.invoke(youractivity, inanimation, outanimation);
} catch (Exception e) {
// Can't change animation, so do nothing
}
最好是有闪屏的主要活动(部分的看到这个例子)。当启动画面是你的主要活动的一部分,你可以简单地分配动画闪屏布局。
It's better to have your splash screen a part of your main Activity (see this example). When the splash screen is part of your main activity, you can simply assign the animation to the splash screen layout.