tags:

views:

24

answers:

1

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.

A: 

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.

ZelluX