PhotoView的使用
16lz
2021-01-26
前言
PhotoView是一个常用的图片预览控件,主要用于Android中大图查看,例如结合ViePager完成朋友圈九宫格图片预览功能,前几天我写的ViewPager分页加载数据这篇博客,可以结合起来使用,PhotoView主要的功能有,图片手势缩放,旋转,相比ImageView,用户体验更好。
今天我主要介绍两个PhotoView的框架,第一个是(https://github.com/chrisbanes/PhotoView)。这个库,应用非常广泛,start数量极高。第二个是(https://github.com/bm-x/PhotoView),这个支持旋转功能,在我公司的项目也用的是这个库。
先看一下效果
- 首先介绍第一个
- 在我们项目module build.gradle中配置
dependencies { compile 'com.github.chrisbanes:PhotoView:2.0.0'}
- 在xml布局中引用该控件
.co.senab.photoview.PhotoView android:id="@+id/photoview" android:layout_width="match_parent" android:layout_height="match_parent"/>
是不是很简单,这就结束了
- 然后介绍下第二个
- 在我们项目module build.gradle中配置
dependencies { compile 'com.bm.photoview:library:1.4.1'}
- 在xml布局中引用该控件
<com.bm.library.PhotoView android:id="@+id/photoview" android:layout_width="match_parent" android:layout_height="match_parent"/>
3.设置可以缩放,默认是不支持缩放的…
photoView.disenable();
更多相关文章
- Android(安卓)纯代码化编码2_基本控件
- 我的Android进阶之旅------>Android实现音乐示波器、均衡器、重
- 2011年Android(安卓)MediaPlayer学习笔记之一
- react-native调用Android原生控件
- Android(安卓)ViewPager 取消预加载
- android实操--练习1
- Android使用GridView实现日历功能(详细代码)
- Android(安卓)tMeasureSpec 含义
- Activity与Service是否处于同一进程? Service 的两大功能是什么?