加载XML缓慢 [英] Load XML slowly

查看:117
本文介绍了加载XML缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们能否加载缓慢隐藏previous XML的XML文件?我希望有一个闪屏的效果。

Can we load an XML file by slowly hiding the previous XML? I want a splash screen effect.

推荐答案

您可以做一个AlphaAnimation。无论是在你的Java code或在你的XML文件(推荐)。

You can do an AlphaAnimation. Either in your Java code or in your XML-file (recommended).

在您的动画XML的文件:做一个像这样的AlphaAnimation:

In your anim xml-file: do an AlphaAnimation like this:

(命名此例如,fadein.xml)

(Name this for example, fadein.xml)

            android:fromAlpha="1.0"
            android:toAlpha="0.0"

然后创建另一个动画XML的文件中像fadeout.xml:

and then create another anim xml-file like fadeout.xml:

            android:fromAlpha="0.0"
            android:toAlpha="1.0"

您可以设置一个时间到动画慢下来。

You can set an duration to slow down the animation.

            android:duration="500" //Time in milliseconds

检查更多AlphaAnimation以及如何在这里实现它:

Check more about AlphaAnimation and how to implement it here:

http://developerlife.com/tutorials/?p=343

http://developer.android.com/reference/android/view/animation/AlphaAnimation.html

您也可以(仅适用于Android 2.0及更高版本)把一个overridePendingTransition,以达到一个类似的效果。

You can also (only for Android 2.0 and higher) put an overridePendingTransition, to achieve a similiar effect.

这篇关于加载XML缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆