Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { static public Bitmap strechToFill(Bitmap b, int width, int height) { float factorH = height / (float) b.getHeight(); float factorW = width / (float) b.getWidth(); return Bitmap.createScaledBitmap(b, (int) (b.getWidth() * factorW), (int) (b.getHeight() * factorH), true); } }