蓝瘦香菇食堂热捧,xwjr,何权
一、什么是photoview
二、代码实战
三、项目源码下载
一款 imageview 展示框架,支持缩放,响应手势,位于图片排行榜的第五位,photoview 与上面不同的是图片的展示功能,可以实现类似微信头像的放大功能,还有就是很多 app 的图片显示响应手势按压式如何是现实的,这里 photoview 将都可以轻松实现。
implementation 'com.bm.photoview:library:1.4.1'
实际项目中,该图片可能是通过网络请求获取的。
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <com.bm.library.photoview android:id="@+id/photoview" android:src="@drawable/test" android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.constraint.constraintlayout>
public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); photoview photoview = findviewbyid(r.id.photoview); photoview.enable();//设置是否允许缩放,默认是不允许的 } }
链接:https://pan.baidu.com/s/1fmedq93ghjpc4a70mh8p9q
密码:kkss
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android studio开发小型对话机器人app(实例代码)
Android通过Java sdk的方式接入OpenCv的方法
Android 通过cmake的方式接入opencv的方法步骤
Android Studio finish()方法的使用与解决app点击“返回”(直接退出)
Android 进度条 ProgressBar的实现代码(隐藏、出现、加载进度)
网友评论