首页 > 代码库 > 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

图片太大无法显示. 硬件加速中 OpenGL对于内存是有限制的

 

解决方式1: 禁用硬件加速
<application android:hardwareAccelerated="false" ...>

 

解决方式2:
比较好的解决方法是类似google map的实现:将图片分成不同的块,每次加载需要的块。android提供了一个方法:

http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html

1public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)
2 
3public Bitmap decodeRegion (Rect rect, BitmapFactory.Options options)

采取上述操作后,就可以加载很多图片,同时也可以显示超级大图了。