PhotoView的使用

前言

PhotoView是一个常用的图片预览控件,主要用于Android中大图查看,例如结合ViePager完成朋友圈九宫格图片预览功能,前几天我写的ViewPager分页加载数据这篇博客,可以结合起来使用,PhotoView主要的功能有,图片手势缩放,旋转,相比ImageView,用户体验更好。


今天我主要介绍两个PhotoView的框架,第一个是(https://github.com/chrisbanes/PhotoView)。这个库,应用非常广泛,start数量极高。第二个是(https://github.com/bm-x/PhotoView),这个支持旋转功能,在我公司的项目也用的是这个库。

先看一下效果例子

  • 首先介绍第一个
  1. 在我们项目module build.gradle中配置
dependencies {
    compile 'com.github.chrisbanes:PhotoView:2.0.0'
}
 
 
  • 1
  • 2
  • 3
  1. 在xml布局中引用该控件
<uk.co.senab.photoview.PhotoView
        android:id="@+id/photoview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
 
 
  • 1
  • 2
  • 3
  • 4

是不是很简单,这就结束了

  • 然后介绍下第二个
  1. 在我们项目module build.gradle中配置
dependencies {
    compile 'com.bm.photoview:library:1.4.1'
}
 
 
  • 1
  • 2
  • 3
  1. 在xml布局中引用该控件
<com.bm.library.PhotoView
        android:id="@+id/photoview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
 
 
  • 1
  • 2
  • 3
  • 4

3.设置可以缩放,默认是不支持缩放的…

photoView.disenable();
 
 
  • 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值