如何创建溢出的2D GridView并且是2D可滚动的

时间:2014-12-12 10:21:16

标签: java android gridview scrollable xml-layout

我只想实现一个溢出屏幕的2D可滚动Gridview。我的基本想法是在简单的scrollview中实现GridView。这个GridView应该包含一些可编辑的网格域,如多重图形但可用于文本。

我基本上是按照以下方式创建的:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <GridView
            android:id="@+id/sessionGrid"
            android:layout_width="FIX-WIDTH-IN-DP"
            android:layout_height="FIX-HEIGHT-IN-DP"
            android:layout_margin="@dimen/padding_outer_border"
            android:columnWidth="@dimen/dashboard_column_width"
            android:background="@color/br_gray_light"
            android:gravity="center"
            android:horizontalSpacing="@dimen/spacing"
            android:numColumns="auto_fit"
            android:stretchMode="columnWidth"
            android:verticalSpacing="@dimen/spacing">
        </GridView>
    </LinearLayout>
</ScrollView>

这会创建一个可垂直滚动的网格视图。但我也无法让它在水平方向上进行滚动。

下图描述了这一点塑料(对于普通链接很抱歉,但我不允许直接在这里发布图片)

http://i.stack.imgur.com/BBpYo.png http://redphoenix.de/data/code/problem.png

我非常感谢在这里给我一些建议,如果我的方法完全不合适,我会很高兴在这里得到一些提示或其他方法。 非常感谢提前

0 个答案:

没有答案