Java tutorial
//package com.java2s; import android.graphics.Matrix; public class Main { public static Matrix getScaleMatrix(float toWidth, int fromWidth, float toHeight, int fromHeight) { Matrix matrix = new Matrix(); matrix.postScale(toWidth / fromWidth, toHeight / fromHeight); return matrix; } }