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.
精彩评论