似乎背景图像在Android中自动缩小,例如,我使用setBackgroundDrawable来设置视图的背景:
Drawable background = getBackground();
myView.setBackgroundDrawable(background);
我希望裁剪图像以适应屏幕尺寸,而不是收缩。怎么做?感谢。
答案 0 :(得分:1)
最后我解决了这个问题。我使用BitmapDrawable而不是Drawable,因为BitmapDrawable具有方法setGravity(int),可以设置重力来定位/拉伸对象。