Android realizes picture click preview effect (zoom animation)

reference resources: https://developer.android.google.cn/training/animation/zoom.html

1. Create views

The following layout includes the large version and small version of view you want to zoom in.

1. Imagebutton is a small version that can be clicked. After clicking, the large version of ImageView will be displayed.

2. ImageView is a large version, which can display the style after clicking the imagebutton.

3. ImageView is invisible at first. When the imagebutton is clicked, it will realize zoom animation, just like expanding and displaying from the imagebutton.

2. Set zoom animation

Set the click event on the imagebutton and execute the zoom animation

3. Realize zoom animation

You need to animate the process from a normal size view to an expanded view.

1. Specify the image you want to zoom to ImageView. (ideally, this bitmap should not be larger than the screen.)

2. Calculate the start and end positions of this ImageView

3. Animate the attributes of four points and scaling size at the same time, from the start state to the end state. These four animations are added to the animatorset to facilitate their simultaneous execution.

4. When the user clicks the screen again, the animation should be executed back. For the same reason, give ImageView a view. Onclicklistener, and then hide ImageView.

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

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
分享
二维码
< <上一篇
下一篇>>