Bitmap too large to be uploaded into a texture

孤人 提交于 2019-11-27 01:59:30

an image in the /drawable/ folder without any specification is considered to be the "default", that is for 1dp = 1px that is mpdi, then because the device you're actually running is xxhdpi that image get's scaled up during runtime.

The original image might be 960x1440, but the conversion from mdpi to xxhdpi is 3 times the size, so your 960x1440 becomes (3*960)x(3*1440) = 2880x4320, which is too large of a texture to apply to the hardware accelerated views.

so to fix that is actually pretty simple, you have two choices:

  1. move your image to /drawable-nodpi/ that's simple, reduces the .apk size, but lower end devices might struggle to load such a big image.
  2. create scaled images on all densities mdpi, hdpi, xhdpi, xxhdpi to avoid runtime over-scaling and to have smaller images on older devices.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!