您好,欢迎访问成都祈钰瑶科技有限公司!

全国咨询热线

18982081108
✕

成都网站建设公司,成都网站UI设计,成都网站安全维护,成都网站内容优化服务

Android第三方控件PhotoView使用方法详解-创新互联

PhotoView的简介:

在梧州等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、做网站 网站设计制作按需网站设计,公司网站建设,企业网站建设,品牌网站设计,全网整合营销推广,成都外贸网站建设公司,梧州网站建设费用合理。

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


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


PhotoView的功能:


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


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


代码演示:

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 xmlns:tools="http://schemas.android.com/tools" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent" 
 tools:context=".MainActivity" 
 android:orientation="vertical" 
 > 
 
 <uk.co.senab.photoview.PhotoView 
 android:id="@+id/iv_photo1" 
 android:layout_width="match_parent" 
 android:layout_height="wrap_content" 
 
 /> 
 <uk.co.senab.photoview.PhotoView 
 android:id="@+id/iv_photo2" 
 android:layout_width="match_parent" 
 android:layout_height="wrap_content" 
 
 /> 
 
</LinearLayout>