I want to show some image thumbnails (images are square) in a GridView
with these constraints that each row shows exactly two image and images fit the screen width (except padding and margins) but have a max width and height (for example 1 inch)
I've read questions but can't resolve the problem. Can you please help me.
GridView xml:
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="10dp"
android:numColumns="2"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
android:stretchMode="columnWidth"
android:verticalScrollbarPosition="right"
android:verticalSpacing="10dp"
android:padding="10dp" />
GridView items xml:
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:maxWidth="72pt"
android:maxHeight="72pt"
/>
I've added two pictures to show what exactly I want
First picture (4 inches cell phone) is exactly what I want, but as screen width grows (tablets or landscape orientation) like image 2, I want to enlarge the image items. (Note that there is a max width size so result in this mode is not same as cell phone pictured in image 1)