android加载长图片出现Bitmap too large to be uploaded into a texture的解决方案
来源:互联网 发布:个人淘宝打假赚钱 编辑:程序博客网 时间:2024/05/16 09:07
最近做图片预览,加载长图片的时候,出现黑屏,无法加载图片的情况,查看Log,发现报出了Bitmap too large to be uploaded into a texture的错误。(我用的是ImageLoader加载器)
在网上搜了很多文章,最后总结出来的解决方案如下:
出错原因分析:
当开启硬件加速的时候,GPU对于openglRender 有一个限制,这个不同的手机会有不同的限制:
这个限制值可以通过canvas.getMaximumBitmapHeight()和canvas.getMaximumBitmapWidth()来获得。
解决方案:
对于ImageLoader的处理方式时可以对ImageView设置最大高度和最大宽度:
android:maxHeight="1000dip"
android:maxWidth="1000dip"
同时相应的scaleType为FIT_CENTER FIT_XY FIT_START FIT_END CENTER_INSIDE
在上面这些scaleType下,当bitmap的高和宽一个大于所设的最大值时,imageloader会自动处理,按比例缩放
当scaleType为 MATRIX CENTER CENTER_CROP时 要高宽两者都大于所设的最大值时,imageloder才会处理。
OK,方法验证有效,可以正确加载长图片预览。
0 0
- android加载长图片出现Bitmap too large to be uploaded into a texture的解决方案
- Android,Gilde框架加载图片进内存。出现的Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture 解决方案
- setImageResource导入图片出现"Bitmap too large to be uploaded into a texture"
- 关于使用ImageLoader出现的Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture 解决方法
- Bitmap too large to be uploaded into a texture exception
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture 解决方法
- Bitmap too large to be uploaded into a texture
- Android加载SD卡图片出现too large to be uploaded into a texture (4128x2322, max=4096x4096)的解决办法
- android - OOM Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture问题的解决方法
- 使用三星手机加载大图的时候,图片不显示出来,提示Bitmap too large to be uploaded into a texture exception
- 【转载】求模和求余的区别
- cornerstone 使用总结
- netty初步,与各个版本的比较
- Android 之 内存管理
- 搜索引擎开发系列文章
- android加载长图片出现Bitmap too large to be uploaded into a texture的解决方案
- 如何使用Linux块设备分区创建ASM(使用UDEV,而非ASMLIB)
- JFinal ORM和Hibernate功能特点对比分析
- android代码审查工具---lint工具的使用
- 做产品的态度
- centos 下memcached的安装到测试
- kmp算法学习
- Android项目所遇问题
- Android 自定义ratingBar(评分小星星)的使用