You should check out Compatibility with different screens
Excerpt from the link:
There is a set of six generalized densities:
ldpi (baja) ~120 dpi
mdpi (media) ~160 dpi
hdpi (alta) ~240 dpi
xhdpi (extraalta) ~320 dpi
xxhdpi (extra extraalta) ~480 dpi
xxxhdpi (extra extra extraalta) ~640 dpi
Depending on each device the resolution varies, for example:
320 dp: una pantalla típica de teléfono (240 x 320 ldpi, 320 x 480 mdpi, 480 x 800 hdpi, etc).
480 dp: una tablet tweener como Streak (480 x 800 mdpi).
600 dp: una tablet de 7” (600 x 1024 mdpi).
720 dp: una tablet de 10” (720 x 1280 mdpi, 800 x 1280 mdpi, etc).
Utility alternative
With the following code you can scale or reduce an image depending on the parameters that you enter, you could infer according to the size of the screen what size of image you want.
public static Drawable resizeImage(Context ctx, int resId, int w, int h) {
// cargas la imagen de origen
Bitmap BitmapOrg = BitmapFactory.decodeResource(ctx.getResources(),
resId);
int width = BitmapOrg.getWidth();
int height = BitmapOrg.getHeight();
int newWidth = w;
int newHeight = h;
// calculas el escalado de la imagen destino
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// para poder manipular la imagen
// debes crear una matriz
Matrix matrix = new Matrix();
// resize the Bitmap
matrix.postScale(scaleWidth, scaleHeight);
// volves a crear la imagen con los nuevos valores
Bitmap resizedBitmap = Bitmap.createBitmap(BitmapOrg, 0, 0,
width, height, matrix, true);
// si queres poder mostrar la imagen tenes que crear un
// objeto drawable y así asignarlo a un botón, imageview...
return new BitmapDrawable(resizedBitmap);
}
Web tool:
Allows you to make some assets and then the copies in the folder of your project. It could become useful to you on occasion.
AndroidAssetStudio