我codifiying我的标志活动与我的主要业务之间的过渡效果,但我之前消失的活动转移到顶部的问题:
I am codifiying a transition effect between my logo activity and my Main activity, but I have the problem that before vanish the activity move to top:
<?xml version="1.0" encoding="utf-8"?>
<alpha
android:duration="2000"
android:fromAlpha="0.0"
android:toAlpha="1.0" >
</alpha>
我怎么能改善这个code只得到一个清漆效果?
How could I improve this code to get only a vanish effect?
您可以使用这两个.xml文件淡入一个新的活动,并淡出了当前活动。
You could use those two .xml files to fade in a new Activity and fade out the current Activity.
fade_in.xml
fade_in.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="500" />
fade_out.xml
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500" />
使用它在code这样的:(在你的活动)
Use it in code like that: (Inside your Activity)
Intent i = new Intent(this, NewlyStartedActivity.class);
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
以上code将淡出当前活动的活动和淡入新启动的活动。
The above code will fade out the currently active Activity and fade in the newly started Activity.