Android Layout: Display as much ImageViews as possible without scrolling

Posted by Toni4780 on Stack Overflow See other posts from Stack Overflow or by Toni4780
Published on 2012-06-01T21:36:52Z Indexed on 2012/06/01 22:40 UTC
Read the original article Hit count: 403

I am working on an app which should display several same size images on the screen. But it should only display only so much images as possible without offering scrolling.

E.g. On a "big" tablet it could display 10x10 Imageviews (screen is large, so there is much space for pictures)

On a "big" phone there might be enough space to display 6x6 ImageViews, so it should only display a 6x6 array of images.

On a small phone there is propably only space for 4x4 ImageViews, so it should only display this.

How can I make this in Android? I know about "layout-large", ... but if i make a special fixed xml-layout for a "large" device, it would not fit all devices correct. E.g. a Galaxy Nexus is a "normal" device and so is a Nexus One, but there would be at least be space for one or two more imageview rows on a Galaxy Nexus than on a Nexus One. So do I have to measure in code somehow how big the resolution is and display some TableRows accordingly? Or is there a special way how I can manage this?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-layout