【问题标题】:Unable to set Horizontal Scroll GridView at bottom of layout (Android)无法在布局底部设置水平滚动 GridView (Android)
【发布时间】:2016-06-03 15:15:22
【问题描述】:

我正在为 GridView 项目使用水平滚动,它工作正常,但它在布局顶部显示图像列表,所以我想在布局底部显示 GridView 列表:

主布局:

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="0dp"
    android:layout_alignParentBottom="true"
    android:padding="0dp">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:scrollbars="none"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:layout_margin="0dp"
        android:padding="0dp">

        <GridView
            android:id="@+id/ImageViewGrid"
            android:layout_width="4000dp"
            android:layout_height="match_parent"
            android:stretchMode="columnWidth"
            android:verticalSpacing="2dp"
            android:layout_alignParentBottom="true"
            android:scrollbars="horizontal"></GridView>
    </LinearLayout>
</HorizontalScrollView>

【问题讨论】:

  • 使用 recyclerview 代替水平标志。
  • 我能举个例子吗

标签: android gridview layout


【解决方案1】:

只需将RecyclerView 用于上述所有布局,并使用水平方向的GridLayoutManager。在您的情况下使用RecyclerView 时不需要HorizontalScrollView

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 2011-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多