简体   繁体   中英

resize all images in gridview to fit the 3x5

I have a GridView with 3 columns and 5 rows of images.

currently configureg like...

<GridView
    android:id="@+id/faces_gridview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numColumns="3" >
</GridView>

I want the images inside to resize themselves to fit 3x5 grid which is different in each phone. how can I tell the GridView to resize the images based on the grid size that I want ?

numColumns sets the columns but it does not reassure me that there will be 5 rows visible in the screen. I don't want to use a scroller.

as per GridView auto fit images & GridView not stretching to all screens

try

android:scaleType="fitXY" in image view 

and

 android:stretchMode="columnWidth" in grid view

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM