How to change the size of bitmaps when loaded from xml

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 12:29:58

问题


I know I can change the size of bitmaps loaded programmatically by using BitmapFactory.Options (i.e. forcing 32 via ARGB_8888 or 16 bit via RGB_565). Is there an equivalent when loading bitmaps via xml (such as when defining drawables and background images in a layout)? If there isn't a built-in switch available that configures this, is there a way to accomplish this other than stripping the graphics out of the xml and handling them manually?


回答1:


You cannot do this from XML, you have to do it from code.



来源:https://stackoverflow.com/questions/5225562/how-to-change-the-size-of-bitmaps-when-loaded-from-xml

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