如何从XML加载时改变位图的尺寸 [英] How to change the size of bitmaps when loaded from xml
问题描述
我知道我可以改变的位图的大小用BitmapFactory.Options(即强迫通过ARGB_8888 32或16通过RGB_565位)的编程方式加载。有装载通过XML位图时的等效(如在一个布局限定可绘制图像和背景图像时)?如果没有一个内置的开关可用的配置这一点,有没有办法比剥出来的图形的XML和手动处理它们做到这一点其他的?
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?
推荐答案
您不能从XML做到这一点,你必须从code做到这一点。
You cannot do this from XML, you have to do it from code.
这篇关于如何从XML加载时改变位图的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!