Activit jumps to a position on the animation interface and splits the animation jump by stretching up and down

Requirement: when the activity (fragment) jumps, the current interface splits, pull out the mobile phone screen up and down, and then jump to the corresponding activity The overall effect drawing is as follows:

Idea: 1. Intercept the screen of the current mobile phone in the current activity to obtain the bitmap, and then calculate the obtained distance from the middle split to the top and bottom of the mobile phone according to the specific location (for example, the split in the middle of the code scanning icon), which is passed to the activity after jump

(the activity before the jump does two things: 1. Intercept the screen to obtain bitmap2, calculate the distance between the specific split position and the top and bottom of the screen, and pass it to the second activity to cut the real screenshot)

2. The activity after jump can execute animation

(, (I didn't bring my own two views in the screenshot. Don't follow the one that has been started in the figure above. If necessary, you can keep me private))

The overall effect is as shown in the figure above. Click code scanning 2, and the middle is split to execute the online stretching animation. (at this time, you can see the activity to jump) 3. The animation ends

Concrete implementation

1: The screenshot of the activity before the jump obtains the bitmap, obtains the value of the split position, and passes it to the second activity for later cutting

**//This is a tool class. You can get the mobile phone screen by calling it directly

1. Obtain the distance between the current scanning buttons,

2, * then the interface jumps and passes the parameter middata

3, * jump to cancel system animation

2: The code intercepts the bitmap of the last activity (fragment) and divides it into two bitmaps that execute animation

1. On the outermost layer of the second activity, a relative layout is covered on it to execute the animation. My free layout is as follows (here I only post the layout on the outer layer, and the layout to be displayed inside is not written)

2. Find the view and set the bitmap that they need to perform animation up and down

3. The animation opening operation is completed. (I didn't bring my own two views in the screenshot. Don't follow the ones that have been started in the above figure. If necessary, you can keep me private)

Finally, summary: 1. Bitmap2 is obtained from the current screenshot. Bitma3, which needs to execute animation on the second activity cutting line, is executing animation (only the open animation is written here, and the closed animation is just an animation)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>