我想从屏幕中心为活动设置动画,然后打开全屏。 (就像开花一样)。
我试过了,但它会滑入。
开始
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="50%"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0%" />
结束
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="0%"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="-100%" />
Intent detail = new Intent(this, DetailActivity.class);
startActivity(detail);
overridePendingTransition(R.anim.start,R.anim.end);
答案 0 :(得分:0)
从ICS开始,默认的开场动画正在按比例放大,这是您想要的。我从ICS资源目录中获取了这些代码。你可以从你的平台文件中找到另一个例子(android-sdk-macosx \ platforms \ android-15 \ data \ res \ anim \ activity _ * .xml)
我从activity_open_enter.xml
获得了以下代码。
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top" >
<alpha
android:duration="@android:integer/config_shortAnimTime"
android:fillAfter="false"
android:fillBefore="false"
android:fillEnabled="true"
android:fromAlpha="0.0"
android:interpolator="@interpolator/decelerate_cubic"
android:toAlpha="1.0" />
<scale
android:duration="@android:integer/config_shortAnimTime"
android:fillAfter="false"
android:fillBefore="false"
android:fillEnabled="true"
android:fromXScale="1.1"
android:fromYScale="1.1"
android:interpolator="@interpolator/decelerate_quint"
android:pivotX="50%p"
android:pivotY="50%p"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>