反正是有设置没有行的GridView控件的Andr​​oid [英] Is there anyway to set the no of row in GridView Android

查看:167
本文介绍了反正是有设置没有行的GridView控件的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是我问错了问题。但是,请你们帮我了。我想网格视图显示格式的图像。
我有5张图片现在我想显示这些图片(单排滚动能)。

May be i am asking wrong question. But please guys help me out. i want to display images in Grid View format. I have 5 images now i want to display these images like this(in single row scroll able).

image1  image2 image3  image4  image5

但是,在移动我们可以同时显示2或3。我们可以设置网格视图中的行像数numColumn:2
感谢您的考虑。

But in mobile we can display 2 or 3 at a time. Can we set the number of rows in Grid View like numColumn:2? Thanks for considering.

推荐答案

如果你需要显示图像的固定数量(例如使用的ImageView )水平,最好的解决方案是使用 Horizo​​ntalScrollView 与单个水平的LinearLayout 子,其中将包含图像。它看起来是这样的:

If you need to display a fixed number of images (for example using ImageView) horizontally, the best solution is using HorizontalScrollView with a single horizontal LinearLayout child, which will contain the images. It will look something like this:

<HorizontalScrollView android:layout_width="match_parent"
                      android:layout_height="wrap_content">
    <LinearLayout android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal">
        <ImageView ...
                   ... />
        <ImageView ...
                   ... />
        ...
    </LinearLayout>
</HorizontalScrollView>

这篇关于反正是有设置没有行的GridView控件的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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