【问题标题】:Android HorizontalScrollView appearing as VerticalAndroid Horizo​​ntalScrollView 显示为 Vertical
【发布时间】:2018-06-20 13:52:02
【问题描述】:

您好,我想创建一个水平滚动视图,但它是垂直的。你能帮忙吗?

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ListView
            android:id="@+id/household_member_list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
</HorizontalScrollView>

下面是出现的内容:

请帮忙。谢谢。

【问题讨论】:

  • 为什么要使用 Horizo​​ntalScrollView?是不是要创建一个水平的ListView?
  • 使用 recyclerview 代替 listview 轻松创建横向行为
  • 嗨,乌德什。是的,我正在尝试创建一个水平 ListView

标签: android listview android-studio horizontal-scrolling horizontalscrollview


【解决方案1】:

您在 ScrollView 中使用 ListView,这将不起作用。

如果你想要水平的ListView你需要使用RecyclerView

更多: Horizontal ListView in Android?

【讨论】:

  • 好的。谢谢,我试试看。
【解决方案2】:

你可以使用recyclerview。 设置水平线性布局为recyclerview的layoutmanager,实现水平滚动

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-16
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-18
    • 2014-02-13
    相关资源
    最近更新 更多