网站租用价格,做网站的高手,公司注册资金最新规定,建网站公建网站公司文章大纲 一、什么是PhotoView二、代码实战三、项目源码下载 一、什么是PhotoView 一款 ImageView 展示框架#xff0c;支持缩放#xff0c;响应手势#xff0c;位于图片排行榜的第五位#xff0c;PhotoView 与上面不同的是图片的展示功能#xff0c;可以实现类似微信头像…文章大纲 一、什么是PhotoView二、代码实战三、项目源码下载 一、什么是PhotoView 一款 ImageView 展示框架支持缩放响应手势位于图片排行榜的第五位PhotoView 与上面不同的是图片的展示功能可以实现类似微信头像的放大功能还有就是很多 App 的图片显示响应手势按压式如何是现实的这里 PhotoView 将都可以轻松实现。 二、代码实战 1. 添加依赖 implementation com.bm.photoview:library:1.4.12. 添加图片资源 实际项目中该图片可能是通过网络请求获取的。 3. 编写xml代码 ?xml version1.0 encodingutf-8? android.support.constraint.ConstraintLayout xmlns:androidhttp://schemas.android.com/apk/res/android xmlns:apphttp://schemas.android.com/apk/res-auto xmlns:toolshttp://schemas.android.com/tools android:layout_widthmatch_parent android:layout_heightmatch_parent tools:context.MainActivity com.bm.library.PhotoView android:idid/photoview android:srcdrawable/test android:layout_widthmatch_parent android:layout_heightmatch_parent/ /android.support.constraint.ConstraintLayout 3. 编写Activity代码 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();//设置是否允许缩放默认是不允许的 } } 4. 运行结果如下 三、项目源码下载 链接:https://pan.baidu.com/s/1fmEDq93ghJpc4a70mH8p9Q密码:kkss转载于:https://www.cnblogs.com/WUXIAOCHANG/p/10667037.html