【问题标题】:ListView in HorizontalScrollView is not going to be horizontal?Horizo​​ntalScrollView 中的 ListView 不会是水平的?
【发布时间】:2016-02-23 04:04:34
【问题描述】:

您好,我正在尝试制作一个水平滚动而不是垂直滚动的 ListView。

我正在尝试使用此代码使 ListView 水平滚动,并且我也在 StackOverflow 上找到了此代码。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#596287">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:minHeight="380dp"
    android:minWidth="380dp"
    android:id="@+id/imageView"
    android:layout_marginTop="5dp"
    android:layout_alignParentTop="true" />

    <HorizontalScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/imageView"
        android:layout_marginTop="5dp">
            <ListView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/listView"
                android:layout_weight="1">
            </ListView>
    </HorizontalScrollView>

我只是想制作一个包含 ImageView 和水平 ListView 的应用程序。像许多照片编辑应用程序或类似的东西。

但是 ListView 没有水平滚动。 请帮帮我。

【问题讨论】:

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


    【解决方案1】:

    ListView 不是为此而设计的,但RecyclerView 是。见this answer.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多