Bitmap three times larger in Android Studio

北战南征 提交于 2019-12-12 10:01:30

问题


I'm developing the splash screen for an Android application and I wanted to simply put an image designed in Photoshop as a background. The problem is that when I save the image its resolution is 1080 x 1920, but when I add it as a drawable in Android Studio, it gives me the error "Bitmap too large..." and says that the resolution is 3240 x 5760 (exactly 3 times bigger). I can't figure out why this happens, can you please help me?

Thanks


回答1:


drawable folder in Android actually represents drawable-mdpi folder.

If you put images in drawable folder they will be upscaled in devices with higher dpi. That is why you are getting larger image.

Put your image in drawable-nodpi folder to prevent automatic up or down scaling of images.



来源:https://stackoverflow.com/questions/36113734/bitmap-three-times-larger-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!