Sample code of image zoom in, zoom out and rotation function in Android
1、 Introduction
2、 Method
1) Set picture zoom in and out effect
Step 1: set Android: scaletype in < ImageView > tag to "fitcenter"
Step 2: get the width of the screen
Step 3: set the maximum progress value of seekbar to the screen width
Step 4: set the layout parameters of ImageView, that is, width and height, that is, the width and height of the canvas
2) Set picture rotation method
Step 1: set the angle of the matrix for the new bitmap
Step 2: get the bitmap resource
Step 3: rebuild the bitmap for display
Step 4: set a new bitmap for ImageView
3、 Code example
design sketch:
Effect drawing of setting size and rotation
code:
fry.Activity02
activity02.xml
4、 Harvest
1. Set image center display
summary
The above is the sample code of the image view zoom in, zoom out and rotation function in Android introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!