GridView row height

谁说胖子不能爱 提交于 2019-11-27 18:46:55

You are in control over your row heights, by virtue of what you put in them. Since your cells appear to have more than one widget, they are presumably wrapped in a LinearLayout or something. Set your LinearLayouts to be some specific height, and the rows will all be that height.

Personally, I think you should be resizing your images if you are going to have text above and below each image on a per-cell basis.

Use drawable as background on Layout that is your grid cell and define that drawable with:

<size android:height="<some height>" />

For example:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
<solid android:color="#ffffff"/>
<size android:height="60dip" />
</shape>
Chase

Here is an alternative solution that pre-measures items and sets the height of each cell to the max height in that row.

GridView rows overlapping: how to make row height fit the tallest item?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!