Bitmap too large to be uploaded into a texture问题的解决方法
来源:互联网 发布:广东电信网络传真 编辑:程序博客网 时间:2024/05/29 10:59
当加载的图片过大时,通常采用的方法是直接按照图片的比例压缩图片,显示出来
避免因为图片的过大而造成Oout of Menmery,具体方法这里看
http://blog.csdn.net/siyehuazhilian/article/details/16965689
但是当图片的宽高比例差距非常大的时候,即长图.
用上述的方法会造成短的一边的像素严重丢失以至于模糊不清
可以在ImageView的属性中设置:
android:maxHeight="1000dip"android:maxWidth="1000dip"
在图片过大的时候ImagLoder会自动处理图片避免OOM
但是仅仅这样,图片有可能会显示不出来,看Log日志:
Bitmap too large to be uploaded into a texture的意思是图片超过了硬件加速所规定的高度
这个时候我们只需要禁止硬件加速即可
android:hardwareAccelerated="false"
事实上,这是一个简单有效的方法
但是这个方法最好在这个Activity比较少用到的时候使用,因为禁止硬件加速总归不是什么好事
还有一个方法是:
重写ImagView的下列两个方法,可以分步显示长图
http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html
1
public
void
drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)
2
3
public
Bitmap decodeRegion (Rect rect, BitmapFactory.Options options)
1 0
- 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 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
- 关于使用ImageLoader出现的Bitmap too large to be uploaded into a texture
- android加载长图片出现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 exception
- 解决:Bitmap too large to be uploaded into a texture exception
- 解决:Bitmap too large to be uploaded into a texture exception
- Bitmap too large to be uploaded into a texture,Hardware accelerated
- 清除多余的COM端口号
- 算法学习之路
- 程序员:伤不起的三十岁
- 《Essential C++》泛型编程
- Linux命令学习手册-patch命令
- Bitmap too large to be uploaded into a texture问题的解决方法
- css hack 用法汇总
- I,P,B帧和PTS,DTS的关系
- BitmapFactory.decodeFile图片过大内存溢出
- 关于安装Genymotion的一些吐槽
- mysql学习01-用户工具-14-05-07
- linux之sed用法
- 题目1020:最小长方形
- N皇后问题