views:

31

answers:

0

I need to make a grid whose width and height is the same as the screen. I guess I would somehow use

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);

to do this but I need to scale the images inside so that each ImageView is 1/10th of the width of the screen (with 10 images for example). Similarly for the image heights.

I have tried

a = (ImageView) findViewById(R.id.imageID);
a.setMaxHeight(metrics.heightPixels/numberOfImages);

But as you can imagine, this is very tedious with 130 images (and not to mention, it doesn't work!) It wouldn't be a problem if I didn't need to cater for lots of screen sizes!

Any help is appreciated! (Bit of an Android noob (-: )