Skip to content Skip to sidebar Skip to footer

Adjust Gridview With Imageviews To Different Screen Sizes, Android

I'd so appreciate if someone could advise on below. My GridView has 3 columns that will be filled with ImageViews: Copy

Step :2 Change your adapter like this.

@Overridepublic View getView(int position, View convertView, ViewGroup parent) {

SquareImageViewimageView=newSquareImageView (mContext);
imageView.setImageResource(mThumbIds.get(position));
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);

return imageView;
}

And your xml like this

<GridView
    android:id="@+id/grid_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:numColumns="3"
    android:gravity="center"
    android:padding="3dp"
    android:stretchMode="columnWidth"
    android:horizontalSpacing="2dp"
    android:verticalSpacing="2dp"
    />

And test in small screen device..It will help you

Post a Comment for "Adjust Gridview With Imageviews To Different Screen Sizes, Android"