在Android使用Fresco注意与工具类
来源:互联网 发布:js获取下一天的日期 编辑:程序博客网 时间:2024/06/05 08:58
Fresco
Fresco中文网
Gradle
compile 'com.facebook.fresco:fresco:0.12.0'
注意
在列表中直接使用setImageURI会出现页面卡顿和图片显示不全或出现纯白色、纯黑色的问题。
FrescoUtils
/** * Created by LiangMaYong on 2016/8/22. */public class FrescoUtils { private static boolean isInit = false; /** * showThumb * * @param draweeView draweeView * @param url url * @param resizeWidthDp resizeWidth * @param resizeHeightDp resizeHeight */ public static void showThumb(SimpleDraweeView draweeView, String url, int resizeWidthDp, int resizeHeightDp) { if (url == null || "".equals(url)) return; if (draweeView == null) return; initialize(draweeView.getContext()); ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)) .setResizeOptions(new ResizeOptions(DimenUtils.dip2px(draweeView.getContext(), resizeWidthDp), DimenUtils.dip2px(draweeView.getContext(), resizeHeightDp))) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(draweeView.getController()) .setControllerListener(new BaseControllerListener<ImageInfo>()) .build(); draweeView.setController(controller); } /** * initialize * * @param context context */ public static void initialize(Context context) { if (isInit) return; ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context) .setDownsampleEnabled(true) .build(); Fresco.initialize(context, config); isInit = true; }}
0 0
- 在Android使用Fresco注意与工具类
- Fresco使用注意点
- Android Fresco工具类的简单使用方法
- 使用Fresco注意的问题
- Retriofit,Fresco,Greendao在Application中的初始化配置工具类
- android使用Fresco在xml中固定宽高比
- android Fresco框架使用与介绍(图片加载组件)
- Android内存讲解与Fresco
- android中倒计时工具CountDownTimer使用注意
- 使用Android Studio编译Fresco
- Android Fresco的简单使用
- Android--Fresco的简单使用
- Android 上图片加载库 Fresco 的使用帮助类
- Fresco 如何在Android Studio中编译
- Fresco 如何在Android Studio中编译
- Android wifi 使用与工具类
- Fresco 图片请求库(工具类)
- Fresco磁盘内存缓存 工具类
- 0j 966 选择不相交区间
- {模版}堆排序
- [Cloud Computing]Mechanisms: Cloud Storage Management Portal
- Android常用Manager
- Codeforces 518D 概率DP
- 在Android使用Fresco注意与工具类
- 关于android中postDelayed方法的讲解
- Django-restful-framwork(serializer相关)
- 恢复oracle中用pl/sql误删除drop掉的表
- javascript浏览器对象——window对象
- cisco路由交换的常用配置
- 查找算法总结
- spring+mybatis整合
- maven和ant区别