res/anim/zoom_enter.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<alpha
android:fromAlpha="0"
android:toAlpha="1.0"
android:duration="700"/>
</set>
res/anim/zoom_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="5.0"
android:fromYScale="1.0"
android:toYScale="5.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="300" />
</set>
res/anim/zoom_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="0.0"
android:fromYScale="1.0"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="500" />
</set>
Activity Class:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_in);
...
}
@Override
public void onBackPressed () {
super.onBackPressed ();
this.overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_out);
}
No comments:
Post a Comment