开发者

Disabling background image shrinking in Android

It seems background 开发者_开发百科images are automatically shrunk in Android, for example, I use setBackgroundDrawable to set background of a view:

Drawable background = getBackground();
myView.setBackgroundDrawable(background);

Instead of shrinking, I want the image to be cropped to fit the screen size. How to do it? Thanks.


Finally I fixed this problem. I use BitmapDrawable instead of Drawable, since BitmapDrawable has method setGravity(int) which can set the gravity to position/stretch the object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜