Fresco gif动画不能设置圆形解决方案
来源:互联网 发布:linux下安装nagios 编辑:程序博客网 时间:2024/05/20 15:12
Fresco gif动画不能设置圆形,为了看到圆形效果,有两种解决方案。
转载注明:http://blog.csdn.net/u014614038/article/details/73609085
1.通过BaseBitmapDataSubscriber获取gif第一帧的图像bitmap,显而易见,这个最终应该可以看到圆形,只是没有了动画效果。我没有试过,具体看这篇文章有介绍。http://blog.csdn.net/hss01248/article/details/52155673?locationNum=14
2.很简单的做法,通过在Fresco控件上面覆盖一个自定义覆盖层,覆盖层view圆圈与Fresco圆形图片大小一样,该圈圈透明可见,覆盖层除圆圈以外的地方填充背景颜色,这样gif也可以实现圆形效果,并且还保留这动画效果。
下面是我写的简单的覆盖层view代码,亲测效果不错:
public class FrescoCirclePicCoverView extends View { public FrescoCirclePicCoverView(Context context) { super(context); init(); } public FrescoCirclePicCoverView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public FrescoCirclePicCoverView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private Paint mPaint; private float Radius = 0; private int CoverColor = Color.parseColor("#c8e3f1"); private void init() { mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setColor(CoverColor); } @SuppressLint("DrawAllocation") @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int Vwidth = getWidth(); int Vheight = getHeight(); Radius = Math.max(Vwidth, Vheight)/2; float Cx = Vwidth/2; float Cy = Vheight/2; Path path = new Path(); path.moveTo(0, 0); path.lineTo(0, Vheight); path.lineTo(Vwidth, Vheight); path.lineTo(Vwidth, 0); path.lineTo(Vwidth/2, 0); path.lineTo(Vwidth/2, Vheight/2-Cy); path.addCircle(Cx, Cy, Radius, Direction.CW); path.lineTo(Vwidth/2, 0); canvas.drawPath(path, mPaint); }}
阅读全文
0 0
- Fresco gif动画不能设置圆形解决方案
- Fresco不能正常显示GIF动画
- fresco加载gif不能动
- 安卓里的gif图片解决方案:Fresco+gif
- Fresco加载gif不能显示问题解决
- Fresco 代码设置圆形进度条实现
- Android Fresco - SimpleDraweeView 圆形动图设置
- Android 简单Fresco动画设置
- Fresco加载gif实现圆角(无动画)
- ps gif动画设置背景
- fresco动画
- Android Fresco gif图
- fresco+本地加载gif
- AS3添加gif动画以及设置大小
- Fresco gif不能使用圆圈或圆角的处理方式
- Fresco 0.10.0 混淆后 不能显示GIF图片(Proguard)
- 使用百分比布局后fresco中SimpleDraweeView不能实现圆形的问题
- Fresco加载gif动图
- 成功的路上必不可少之 --- 专注与坚持
- Android开发实战使用(VR技术实现360°全景视频播放功能)
- Kafka集群
- 实用的 CSS — 贝塞尔曲线(cubic-bezier)
- 我是如何轻松学实用英语
- Fresco gif动画不能设置圆形解决方案
- android隐藏状态栏zongji
- Vim--------常用命令总结
- Nexus解锁、root、刷机教程
- EventBus框架总结之源码分析
- Qt进度条用法总结
- Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0
- 数据库表关联关系表结构字段命名
- Hive安装配置指北(含Hive Metastore详解)