开发者

Load XML slowly

Can we load an XML file by slowly hiding the previous XM开发者_开发问答L? I want a splash screen effect.


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

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

(Name this for example, fadein.xml)

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

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

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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜