GridView的行高 [英] GridView row height

查看:170
本文介绍了GridView的行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示图像,这是不同尺寸的,不幸的是,一个GridView。他们是两行文字之间所示:

I have a GridView that displays images, which are, unfortunately, of different sizes. They are shown in between two lines of text:

text1.1                text1.2
ImageView(IMAGE1)      ImageView(IMAGE2)
text2.1                text2.2

text3.1
ImageView(IMAGE3)
text4.1

等等...

etc....

如果此搜索是一样的高度IMAGE2,一切都很好,但如果此搜索是不再比IMAGE2,text2.1会碰上text3.1(填充似乎并没有多大帮助,因为有太多的它,当图像高度相同的)。

If IMAGE1 is the same height as IMAGE2, everything is fine, but if IMAGE1 is longer than IMAGE2, text2.1 will run into text3.1 (padding doesn't seem to help much, as there's too much of it when images are of the same height).

我知道有一种方法可以伸展在ImageView的,使他们的高度相同的图像,但有可能保持图像的是,设置在行高不知何故?

I know there's a way to stretch the images in the ImageView so they are the same height, but is it possible to keep images as is and set the row height somehow?

推荐答案

您在控制你的行高,凭借什么你把他们。因为你的细胞似乎有一个以上的小部件,它们是presumably包裹在一个的LinearLayout 什么的。设置你的 LinearLayouts 是一些特定的高度,行会都是这样的高度。

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.

这篇关于GridView的行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆