Reprint Please specify source: http://blog.csdn.net/zhaokaiqiang1992
The open source project that we are going to introduce to you today is the Photoview project from GitHub, the main function of this project is to achieve the reduction of the image of the common ImageView control, including single touch and multi touch.
PhotoView's GitHub project address: Https://github.com/chrisbanes/PhotoView
The directory structure of the test project
We can copy the Photoview resource files directly to the project.
Here is the key code
Package Com.example.photoview;import Uk.co.senab.photoview.photoviewattacher;import Android.app.activity;import Android.graphics.drawable.drawable;import Android.os.bundle;import Android.widget.imageview;public Class Mainactivity extends Activity {private ImageView img;private photoviewattacher attacher; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); img = (ImageView) Findviewbyid (r.id.img);D rawable drawable = Getresources (). getdrawable (R.drawable.ico); Img.setimagedrawable (drawable); attacher = new Photoviewattacher (IMG); attacher.update ();}}
If we were to use the following code,mimageview.setimagedrawable/setimagebitmap/setimageresource/and so on, we just need to call Attacher.update ().
Demo: Https://github.com/ZhaoKaiQiang/PhotoViewDemo
"Android Interface Implementation" Photoview project--implementation of single point/multi-touch zoom image Support