There are several ways you can do it.
Option 1:
Create different perfect images for different dpi and place them in related drawable folder. Then set
android:background="@drawable/your_image
option 2:
create a scaled Bitmap which fits your layout..
/* adapt the image to the size of the display */
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
Bitmap bmp = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(
getResources(),R.drawable.background),size.x,size.y,true);
BitmapDrawable background = new BitmapDrawable(bmp );
layout.setBackgroundDrawable(background);
Option 3:
dont need to create bitmat image every time. you can put it in Cache memory after first time creation. then try to fetch from Cache if not found then process your drawable image again as a bitmap and put it into Cache and use it. it will be faster process..
there is a link for more detail.. Caching Bitmaps