Android matrix can enlarge, shrink or drag pictures at will

This example shares the specific code of random zoom in, zoom out and drag of Android matrix pictures for your reference. The specific contents are as follows

Step1: create a new project dragandzoom, and prepare a photo and put it in the RES / drawable hdpi directory, as shown in the following figure:

Step 2: set the UI interface of the application in main.xml:

Step3: implement specific requirements in mainactivity.java

step4:AndroidMainfest.xml

Step 5: specific renderings

The above two are the effects of picture dragging, and the picture scaling effect can only be seen in the real machine. Please test it in the real machine environment.

Note: the specific program source code is: download the program source code

In fact, you can also zoom the picture through gestures. The faster the zoom speed is, the larger the zoom ratio is

zoom.xml

GestureZoom.java

See the effect of running

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support 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
分享
二维码
< <上一篇
下一篇>>