Custom transition between android actions

I am creating an Android application and I want to have a custom transition from one action to another. when I press the button in the first operation, I want it to reduce its size and go to one of the corners of the screen until it disappears, and the second action is called. Of course, during resizing and moving the first action, the second action will begin to appear (I want to say that during this time I do not want to have a black screen at the bottom). Does anyone have experience with such things? I also want to note that I am creating my application for API 3.0+, so new functions and methods can be used. Thank!

+3
source share
1 answer

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.

+14
source

All Articles