fresco加载图片方法

布局文件引入 xmlns:fresco="http://schemas.android.com/apk/res-auto"

    <com.facebook.drawee.view.SimpleDraweeView
android:id="@id/img_icon"
android:layout_width="42.0dip"
android:layout_height="42.0dip"
android:layout_marginLeft="12.0dip"
android:layout_marginTop="20.0dip"
fresco:roundAsCircle="true"
fresco:failureImage="@drawable/my_face"
fresco:failureImageScaleType="centerInside"/>

加载图片方法

m.SimpleDraweeView.setImageURI(Uri.parse(imageUrl));

加载网络图片一切正常(网络图片测试没有1M以上的 都是通过七牛云存储裁剪后显示的)
当获取本地手机相册的时候 提示Bitmap too large to be uploaded into a texture 
fresco默认不是打印Log的 打开方式如下
Set<RequestListener> requestListeners = new HashSet<>();
requestListeners.add(new RequestLoggingListener());
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(appContext)
// other setters
.setRequestListeners(requestListeners)
.build();
Fresco.initialize(appContext, config);
FLog.setMinimumLoggingLevel(FLog.VERBOSE);

搜索  Bitmap too large to be uploaded into a texture  关键字网上说在 application 加入android:hardwareAccelerated="false" 关闭硬件加速,个人感觉既然作为最火的fresco一定有解决办法于是在官网找到了

http://www.fresco-cn.org/docs/requesting-multiple-images.html

有这么一个属性 .setLocalThumbnailPreviewsEnabled(true)

本功能仅支持本地URI,并且是JPEG图片格式

如果本地JPEG图,有EXIF的缩略图,image pipeline 可以立刻返回它作为一个缩略图。Drawee 会先显示缩略图,完整的清晰大图在 decode 完之后再显示。

我的理解是fresco去获取相册的缩略图经测试还是不行依然不显示。

我又换了关键字搜索 在日志前面加入了fresco 变成 fresco Bitmap too large to be uploaded into a texture

在结果中第一条记录就是http://stackoverflow.com/questions/33676807/fresco-bitmap-too-large-to-be-uploaded-into-a-texture

ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
.setProgressiveRenderingEnabled(true)
.setAutoRotateEnabled(true)
.setLocalThumbnailPreviewsEnabled(true)
.setResizeOptions(new ResizeOptions(view.getLayoutParams().width, view.getLayoutParams().height))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(view.getController())
.setAutoPlayAnimations(true).build();
view.setController(controller);

运行测试显示正常 大功告成^0^

---------------------------------------------------分割线----------------------------------------------------------------
在次编辑 以下代码也可以实现加载本地相册,上面代码有时候有错误 无法获取宽和高,除非指定
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(getApplicationContext())
.setDownsampleEnabled(true)
.build();
Fresco.initialize(getApplicationContext(), config);
												

fresco Bitmap too large to be uploaded into a texture的更多相关文章

  1. 解决:Bitmap too large to be uploaded into a texture exception

    前几天拿锤子手机做测试,启动页面的闪屏直接黑屏.. 所以看下日志,百度一下 找到解决方案,特此记录. 简单说就是硬件加速的时候,对图片的大小有限制.不同设备可能有不同的最大值.这个问题悲催的地方是,程 ...

  2. imageview设置图片时超长超大图片超出限制(OpenGLRenderer: Bitmap too large to be uploaded into a texture (996x9116, max=4096x4096))

    问题:遇到超长图片,宽长等比缩放,比如宽度同屏幕同宽,长度等比放大,放到后遇到长度超出OpenGLRenderer的最大限制,导致图片无法显示出来: 解决办法: //图片超出GPU对于openglRe ...

  3. Bitmap too larget to be uploaded into a texture的解决方法

    Bitmap too larget to be uploaded into a texture的解决方法 问题描述 使用canvas.drawBitmap()系列方法时,抛出错误Bitmap too ...

  4. Android Bitmap太大导致ImageView不显示的问题

    今天做我们的智能相冊的项目时,遇到了非常奇妙的问题,当照片太大时,导致ImageView.setImageBitmap不显示,上网上搜了非常多办法.感觉都不是那么靠谱.最后使用了简单粗暴的手段: // ...

  5. 跨越适配&性能那道坎,企鹅电竞Android weex优化

    WeTest 导读 企鹅电竞从17年6月接入weex,到现在已经有一年半的时间,这段时间里面,针对遇到的问题,企鹅电竞终端主要做了下面的优化: image组件 预加载 预渲染 Image组件 weex ...

  6. bug1

    1从相册中获取图片,低版本可以,高版本不行.看见抛出 Bitmap too large to be uploaded into a texture 原来是高版本的android,机子好点,相机就好点, ...

  7. android 使用相机拍照,并存储到手机sd卡上,并利用系统录像录像并播放

    //首先声明一个成员变量 String savePath,用来储存文件路径 /** * 保存照片路径 * @return 返回图片的一个文件 * @throws IOException 抛出一个异常 ...

  8. ImageView的子类无法加载图片

    在图片预览时,偶现图片无法现实,在查看程序的时候发现Bitmap是实际存在的,但是在ImageView中缺绘制不出来,这个问题困然了我很久,查看代码也查不出原因,再加上是偶现的,查原因时费了不少时间. ...

  9. 你需要知道的 Android 拍照适配方案

    近段时间,家里陪自己度过大学四年的电脑坏了,挑选好的新电脑配件终于在本周全部到货,自己动手完成组装.从AMD到i7的CPU,6G内存到14G内存,打开 AndroidStudio 的速度终于杠杆的上去 ...

随机推荐

  1. Educational Codeforces Round 10

    A:Gabriel and Caterpillar 题意:蜗牛爬树问题:值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1: day = (End - Begin - day0)/ ...

  2. html + css (1)

    a{ text-decoration:none; /* 规定添加到文本的修饰;下划线没有了 */ margin:0px; font-size:15px; display: block; /* 以块级元 ...

  3. First Blog, “Hello, world!”

    As every single book says as a tradition, "Hello, world!" An explanation about the name – ...

  4. Orchard Platform v1.7.2 发布

    发布说明: 1. 添加Json格式数据文件支持.2. 删除了Settings, Modules, Themes模块中的Routers和Controllers.3. 删除了默认的ContentType, ...

  5. 【基础知识】Sql和Ado.Net第12天

    一. 主键(PrimaryKey) 1. 主键是数据行的唯一标识.不能重复,不可为空,主键建议选择一般不会修改的列! 2. 主键的作用:保证表中的每条数据的唯一性. 3. 主键的分类: a) 逻辑主键 ...

  6. 2014年市场需求排名前10的编程语言 - 生命的延续是 BI

    开篇介绍 2014年就快收尾了,Team 内部每人都会准备一些 Tech Talk 的内容,技术方面的,咨询方面的都可以.我就准备了一些有关 BI 排名,BI 报表排名,包括各种技术编程语言等相关排名 ...

  7. openVPN报错:All TAP-Windows adapters on this system are currently in use

    解决办法: 1. 确定openVPN服务已打开. 2. 控制面板\网络和 Internet\网络连接,确定TAP-Windows Adapter V9已经启动.

  8. 扯扯Java中Finalization的意义

    这是Stack Overflow上关于Finalizetion意义的两段讨论,这两个观点是互为补充的. 观点1: 垃圾回收器(The garbage collector)自动在后台运行(虽然它也可以被 ...

  9. java web图片显示到浏览器

    今天研究了一下午,图片显示问题. jsp中获取绝对路径的方法:String contextPath = request.getContextPath();String path = request.g ...

  10. struts2学习笔记之四:多配置文件支持和常用配置参数

    struts2支持可以按照不同模块分类的方式拆分配置文件,支持多人分工合作,各自维护自己的配置文件,但是所有配置文件中包名和action的名称不能重复   struts2的配置文件方式有两种,stru ...