You can use simple animation for this. In the second exercise, you can do something like:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.scale_from_corner, R.anim.scale_to_corner);
}
For animations, this will be:
scale_to_corner.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromYScale="1.0" android:toYScale="0"
android:fromXScale="1.0" android:toXScale="0"
android:duration="500"/>
</set>
and scale_from_corner.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromYScale="0" android:toYScale="1.0"
android:fromXScale="0" android:toXScale="1.0"
android:duration="500" android:pivotX="100%"
android:pivotY="100%" />
</set>
This will cause your first action to decrease in the upper left corner, while your second asset will grow from the lower right corner. If you want to change the point at which they grow or shrink, you can simply change pivotX and pivotY.
source
share