Android第三方控件PhotoView使用方法详解

  

<强> PhotoView的简介:
  

  

这是一个图片查看库,实现图片浏览功能,支持捏捏(合)手势或者点击放大缩小。支持在:viewpage中翻页浏览图片。
  

  

PhotoView是一款扩展自Android ImageView支持通过单点/多点触摸来进行图片缩放的智能控件。功能实用和强大。
  

  

<强> PhotoView的功能:
  

  

图片浏览查看
  双指缩放
  单点触摸缩放
  图片缩放模式设置
  

  

<>强基本用法:
  强导入jar包,布局XML里设置PhotoView
  将ImageView传入PhotoViewAttacher
  

  

<强>代码演示:
  

  

使用PhotoView进行网络图片和本地图片的加载,缩放和点击事件处理
  布局文件中:
  

        & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android "   xmlns:工具=" http://schemas.android.com/tools "   android: layout_width=" match_parent "   android: layout_height=" match_parent "   工具:上下文=" .MainActivity "   android:取向=按怪薄?   比;      & lt; uk.co.senab.photoview.PhotoView   android: id=癅 + id/iv_photo1”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "/比;   & lt; uk.co.senab.photoview.PhotoView   android: id=癅 + id/iv_photo2”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "/比;      & lt;/LinearLayout>之前      

MainActivity中:
  

        公开课MainActivity延伸活动{   私人PhotoView iv_photo1;   私人PhotoView iv_photo2;         @Override   保护空白>/* *   *加载网络图片时,需要对ImageLoader进行全局配置   *   */公开课BaseApplication扩展应用程序{      @Override   公共空间>   & lt; uses-permission android: name=" android.permission.INTERNET "/比;   & lt;应用程序   android: name=" com.zhhandroid.BaseApplication "   android: allowBackup=" true "   android:图标=" @drawable/ic_launcher”   android: label=" @string/app_name”   android:主题=癅style/AppTheme”比;   & lt;活动   android: name=" .MainActivity "   android: label=" @string/app_name”比;   & lt; intent-filter>   & lt;行动android: name=" android.intent.action.MAIN "/比;      & lt;类别android: name=" android.intent.category.LAUNCHER "/比;   & lt;/intent-filter>   & lt;/activity>   & lt;/application>   之前      

需要导入的jar包:

  

photoview-library-1.2.2。jar
  universal-image-loader-1.9.2_sources。jar
  

  

效果展示:

  

 Android第三方控件PhotoView使用方法详解

  

jar包及源码:下载

  

这个库里面上面库里面有bug,参考这个库

  

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

Android第三方控件PhotoView使用方法详解