"Android Interface Implementation" photoview--single-point support/multi-image scaling for touch

Source: Internet
Author: User

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 normal ImageView control, which includes single touch and multi touch.

PhotoView's GitHub project address: Https://github.com/chrisbanes/PhotoView

The folder structure of the test project

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhhb2thaxfpyw5nmtk5mg==/font/5a6l5l2t/fontsize/400/fill/ I0jbqkfcma==/dissolve/70/gravity/southeast ">


We can copy the Photoview resource files directly to the project.

Here are the key codes

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 ();}}

Let's say we're in the code behind. Used amimageview.setimagedrawable/setimagebitmap/setimageresource/and so on, we just need to call Attacher.update ().

Demo: Https://github.com/ZhaoKaiQiang/PhotoViewDemo

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

"Android Interface Implementation" photoview--single-point support/multi-image scaling for touch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.