如何在 GridView 安卓中获得垂直滚动



我正在开发一个显示图像的安卓应用程序。我正在使用grid view在我的应用程序中显示图像。

但是默认网格视图是horizontal scrolling我想在网格视图中显示图像vertical scrolling

请向我建议一种在网格视图中实现垂直滚动的方法。

提前谢谢。

使用android:numColumns="3" // this will force gridview to have 3 columns and if you have more than 3 items in grid view, you can have vertical scrolling.

前任。:

<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridView1"
    android:numColumns="3"
    android:gravity="center"
    android:columnWidth="50dp"
    android:stretchMode="columnWidth"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
</GridView>

最新更新