网站首页 > 编程文章 正文
Android UI Libs之PhotoView
1. 说明
PhotoView可以帮助我们快速简单的实现一个放大ImageView
中图片的功能,这个功能在查看图片时非常常用,通过触摸放大图片。
2. 配置
首先在工程的build.gradle上面添加JitPack仓库
allprojects {repositories { ...
maven { url "https://jitpack.io" }
}
}
其次,在模块的build.gradle上面添加依赖
dependencies {compile 'com.github.chrisbanes:PhotoView:1.2.6'}
3. 基本使用
使用该库来放大ImageView
中图片有两种方式:
直接使用
PhoteView
在xml中定义
<uk.co.senab.photoview.PhotoViewPhoteView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
程序运行界面如下:
配合
PhotoViewAttacher
使用ImageView
:在xml中定义
<ImageViewImageView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在java文件中进行相关操作:
this.image = (ImageView) findViewById(R.id.image);mAttacher = new PhotoViewAttacher(image);
程序运行界面如下:
Android UI Libs之PhotoView
1. 说明
PhotoView可以帮助我们快速简单的实现一个放大ImageView
中图片的功能,这个功能在查看图片时非常常用,通过触摸放大图片。
2. 配置
首先在工程的build.gradle上面添加JitPack仓库
allprojects {repositories { ...
maven { url "https://jitpack.io" }
}
}
其次,在模块的build.gradle上面添加依赖
dependencies {compile 'com.github.chrisbanes:PhotoView:1.2.6'}
3. 基本使用
使用该库来放大ImageView
中图片有两种方式:
直接使用
PhoteView
在xml中定义
<uk.co.senab.photoview.PhotoViewPhoteView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
程序运行界面如下:
配合
PhotoViewAttacher
使用ImageView
:在xml中定义
<ImageViewImageView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在java文件中进行相关操作:
this.image = (ImageView) findViewById(R.id.image);mAttacher = new PhotoViewAttacher(image);
程序运行界面如下:
Android UI Libs之PhotoView
1. 说明
PhotoView可以帮助我们快速简单的实现一个放大ImageView
中图片的功能,这个功能在查看图片时非常常用,通过触摸放大图片。
2. 配置
首先在工程的build.gradle上面添加JitPack仓库
allprojects {repositories { ...
maven { url "https://jitpack.io" }
}
}
其次,在模块的build.gradle上面添加依赖
dependencies {compile 'com.github.chrisbanes:PhotoView:1.2.6'}
3. 基本使用
使用该库来放大ImageView
中图片有两种方式:
直接使用
PhoteView
在xml中定义
<uk.co.senab.photoview.PhotoViewPhoteView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
程序运行界面如下:
配合
PhotoViewAttacher
使用ImageView
:在xml中定义
<ImageViewImageView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在java文件中进行相关操作:
this.image = (ImageView) findViewById(R.id.image);mAttacher = new PhotoViewAttacher(image);
程序运行界面如下:
Android UI Libs之PhotoView
1. 说明
PhotoView可以帮助我们快速简单的实现一个放大ImageView
中图片的功能,这个功能在查看图片时非常常用,通过触摸放大图片。
2. 配置
首先在工程的build.gradle上面添加JitPack仓库
allprojects {repositories { ...
maven { url "https://jitpack.io" }
}
}
其次,在模块的build.gradle上面添加依赖
dependencies {compile 'com.github.chrisbanes:PhotoView:1.2.6'}
3. 基本使用
使用该库来放大ImageView
中图片有两种方式:
直接使用
PhoteView
在xml中定义
<uk.co.senab.photoview.PhotoViewPhoteView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
程序运行界面如下:
配合
PhotoViewAttacher
使用ImageView
:在xml中定义
<ImageViewImageView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在java文件中进行相关操作:
this.image = (ImageView) findViewById(R.id.image);mAttacher = new PhotoViewAttacher(image);
程序运行界面如下:
的
Android UI Libs之PhotoView
1. 说明
PhotoView可以帮助我们快速简单的实现一个放大ImageView
中图片的功能,这个功能在查看图片时非常常用,通过触摸放大图片。
2. 配置
首先在工程的build.gradle上面添加JitPack仓库
allprojects {repositories { ...
maven { url "https://jitpack.io" }
}
}
其次,在模块的build.gradle上面添加依赖
dependencies {compile 'com.github.chrisbanes:PhotoView:1.2.6'}
3. 基本使用
使用该库来放大ImageView
中图片有两种方式:
直接使用
PhoteView
在xml中定义
<uk.co.senab.photoview.PhotoViewPhoteView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
程序运行界面如下:
配合
PhotoViewAttacher
使用ImageView
:在xml中定义
<ImageViewImageView
:android:id="@+id/image"
android:src="@drawable/image"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在java文件中进行相关操作:
this.image = (ImageView) findViewById(R.id.image);mAttacher = new PhotoViewAttacher(image);
程序运行界面如下:
程序源代码下载,我的github仓库:https://github.com/lavor-zl/UILibs
欢迎关注我的简书专题:Android技术漫谈
欢迎关注我的微信公众号:Android技术漫谈
猜你喜欢
- 2024-10-22 产品经理小技术:图片素材随手找,原型设计快又好
- 2024-10-22 Android设置Button按钮的点击,触碰状态效果
- 2024-10-22 AndroidStudio安卓原生开发_UI高级_StateListDrawable状态选择器
- 2024-10-22 Activity初窥门径(初窥门径是什么意思)
- 2024-10-22 Litho的使用及原理剖析(lithiumtools)
- 2024-10-22 Android图片加载框架哪家强?当然是FaceBook出品的Fresco
- 2024-10-22 Android Pixel 预览版(pixel preview)
- 2024-10-22 Android 属性动画资源(android属性动画平移)
- 2024-10-22 Android屏幕适配方案(android 屏幕适配方案)
- 2024-10-22 关于Android系统各个版本之间的新功能
你 发表评论:
欢迎- 06-24一个老爸画了超级有爱的365幅画 | 父亲节献礼
- 06-24产品小白看魏则西事件——用产品思维审视百度推广
- 06-24某教程学习笔记(一):13、脚本木马原理
- 06-24十大常见web漏洞——命令执行漏洞
- 06-24初涉内网,提权那些事(内网渗透提权)
- 06-24黑客命令第16集:47种最常见的**网站方法2/2
- 06-24铭说 | 一句话木马的多种变形方式
- 06-24Java隐藏的10倍效率技巧!90%程序员不知道的魔法方法(附代码)
- 最近发表
- 标签列表
-
- spire.doc (70)
- instanceclient (62)
- solidworks (78)
- system.data.oracleclient (61)
- 按键小精灵源码提取 (66)
- pyqt5designer教程 (65)
- 联想刷bios工具 (66)
- c#源码 (64)
- graphics.h头文件 (62)
- mysqldump下载 (66)
- libmp3lame (60)
- maven3.3.9 (63)
- 二调符号库 (57)
- git.exe下载 (68)
- diskgenius_winpe (72)
- pythoncrc16 (57)
- solidworks宏文件下载 (59)
- qt帮助文档中文版 (73)
- satacontroller (66)
- hgcad (64)
- bootimg.exe (69)
- android-gif-drawable (62)
- axure9元件库免费下载 (57)
- libmysqlclient.so.18 (58)
- springbootdemo (64)
本文暂时没有评论,来添加一个吧(●'◡'●)