Message info
To:Android Developers From:EhyehAsherEhyeh Subject:[android-developers] Re: Different sized images, arrangement and layout problem Date:Thu, 29 Mar 2012 00:28:08 -0700 (PDT)

ScrollView can only hold one view, so put a LinearLayout in there
(orientation horizontal). Put three LinearLayouts in that
LinearLayout, use layout_weight to give them equal spacing (doesn't
matter what you set each weight to as long as they each get equal
weight and as long as those three are the only immediate children of
the wrapping LinearLayout.) The weights indicate how large a portion
of the free space each layout should get, after they've each been
allotted the width they request in layout_width, so set each of them
to width="0dp", which means all the space is "free space" and the
weights should distribute all available width. Once that's done you
have your three columns, so just set each imageview you add to them to
have width="fill_parent" and an appropriate scaling type and you're

On Mar 29, 1:12am, Farhan Tariq <> wrote:
> Hi everyone,
> I need to make an application that would show a number of images on the
> screen. The images can vary in height and width. I want to be able to show
> the images in a scrollView, such that there are no empty spaces between
> images. So...
> 1 - its a scrollable view,
> 2 - with 3 columns. Each column has a fixed width,
> 3 - and each image of different heights and widths adjusts its width
> according to the width of the column.
> The number of images is not known, and they would be added to the
> scrollView at runtime. How do I construct this view? Would scrollview be a
> good choice? Can I have a gridView for the purpose?

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at