I'm trying to use the GridView to create an image gallery index that will look similar to the Ice Cream Sandwhich gallery app:
http://www.techdron.com/wp-content/uploads/2011/10/sw_albums.jpg
(Sorry I can't use the img tag yet)
I'm looked at all of the common tutorials (e.g. http://developer.android.com/resources/tutorials/views/hello-gridview.html) and none of them really give me what I'm looking for.
Right now I have the following:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="100dp"
android:numColumns="auto_fit"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp"
android:stretchMode="none"
android:gravity="center"
android:layout_weight="1"
android:background="#000000"/>
And I am creating my views in the adapter like so:
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(148,148));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
It's close but the feeling really isn't the same, and I'm not sure that it will scale well on all devices. Does anyone know of a way to use the GridView like this? Or should I be looking at using another widget, e.g. the GridLayout.
Thanks.