I want to create a 5x5 GridView of images in my application. The
images I am using are 100x100 pixels but I want to resize them so that
they keep the 1:1 aspect ratio and so that 5 of them can fit into one
row of the GridView. I have the following in my layout file:
<GridView android:id="@+id/grid" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:numColumns="5"
android:stretchMode="columnWidth"
android:horizontalSpacing="4dp"
android:verticalSpacing="4dp" android:background="#ff000000"
android:gravity="center"></GridView>
I am using a custom adapter that creates an ImageView and sets the
ScaleType to CENTER_INSIDE which resizes the image to keep the aspect
ratio and centers it inside the view. However, the size of my view
does not have the 1:1 aspect ratio that my image has. The width is
adjusted so that 5 of them can fit on one row but the height remains
at 100px so there is a lot of blank space at the top and bottom of the
ImageView. I can set a width and height for the ImageView and
everything looks good on the emulator but I want the layout to work on
different resolution screens.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en