android -------- GifView 显示gif图片
2024-08-26 14:54:21
最近的项目需要在界面显示Gif动图,查找网络资料,总结了一下,分享一下,
一个GifView的gif图加载库以有效地显示GIF,
您可以启动,暂停和停止gifView
在app 的 build.gradle 中
implementation 'com.github.Cutta:GifView:1.4'
效果图:
1:布局直接显示
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif1" /> <com.cunoraz.gifview.library.GifView
android:id="@+id/gif3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
/> </LinearLayout>
2:代码
/***
* 属性
*
* gifView1.setGifResource(R.mipmap.gif_start_stop);
* gifView1.play();
* gifView1.pause();
* gifView1.setGifResource(R.mipmap.gif5);
* gifView1.getGifResource();
* gifView1.setMovieTime(time);
* gifView1.getMovie();
*/ private void show(){
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { if (gifView1.isPlaying())
gifView1.pause();
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { if (gifView1.isPaused())
gifView1.play();
}
});
}
代码文档:https://github.com/Cutta/GifView
最新文章
- Web服务器控件之button
- 深入理解http/https协议
- 学习 Linux,101: Linux 命令行
- ssh git免密码提交代码
- JFreeChart 使用一 饼图之高级特性
- 《深入PHP与jQuery开发》读书笔记——Chapter1
- 101个MySQL 的调节和优化的提示
- java的回忆录
- Controller中利用RedirectToRoute重定向的问题
- PHP学习笔记(八)
- 如何解决设置Session保存在StateServer后引起WebService/WebMethod无法异步获取Session
- Codeforces 715A &; 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))
- nginx 配置以及常用命令
- dedecms likearticle 调用附加表的字段调用方式
- 点击显示子菜单,离开隐藏子菜单(onmouseout下包含a标签的js解决方法)
- [模板][Luogu3387] 缩点 - Tarjan, 拓扑+DP
- Java学习之--List和ArrayList
- Android面试准备20190422
- JavaScript事件属性event.target
- 得到ImageView中drawable显示的区域的计算方法
热门文章
- python判断目录或者文件
- springboot学习笔记(一)
- Hibernate的关联关系映射
- [TypeScript ] Using the Null Coalescing operator with TypeScript 3.7
- php自定义函数之回调函数
- 2019/7/18 --1.<;%@ include file=";";%>;与<;jsp:include page=";";/>;两种方式的作用
- PHP安装之configure的配置参数
- Makefile(二)
- 数据结构实验之查找六:顺序查找(SDUT 3378)
- avalon在公共页面里面写的功能,怎么让某些页面不引用到这个方法和html?