【问题标题】:GridView nested into HorizontalScrollView works weird嵌套到 Horizo​​ntalScrollView 的 GridView 工作很奇怪
【发布时间】:2016-07-12 18:28:00
【问题描述】:

将包含 22 个项目的 GridView 嵌套到 HorizontalScrollView 中。 GridView 有 22 项,4 列 6 行,最后只有 2 项没有嵌套。但是嵌套后只出现第一列,所以 1 列和 6 行带有图像。为什么不是所有带有水平滚动选项的项目?我猜有问题,或者 HorizontalScrollView 设置中缺少。

   <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/seatLegendLayout">

        <GridView
            android:id="@+id/gridView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="4dp"
            android:columnWidth="100dp"
            android:gravity="center"
            android:numColumns="4"
            android:horizontalSpacing="1dp"
            android:scrollbarAlwaysDrawHorizontalTrack="true"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbars="horizontal"
            android:stretchMode="none"
            android:verticalSpacing="1dp">

        </GridView>

    </HorizontalScrollView>

【问题讨论】:

标签: java android gridview


【解决方案1】:

我使用 TwoWayListView 制作水平列表视图,在我使用 eclipse 时效果很好。

将我的应用程序迁移到 android studio 后,我正在使用 RecylerView,它为我提供了将列表置于水平或垂直方向所需的功能,它还支持网格和卡片

尝试阅读有关此内容,它是那些日子最常用于开发的内容

祝你好运

【讨论】:

  • RecyclerView 只能水平或垂直滚动​​一种方式?因为我需要能够双向滚动。
猜你喜欢
  • 1970-01-01
  • 2012-11-29
  • 2013-12-22
  • 1970-01-01
  • 1970-01-01
  • 2014-08-15
  • 2011-05-07
  • 1970-01-01
  • 2016-07-10
相关资源
最近更新 更多