Android Horizo​​ntalScrollView 显示为 Vertical

标签 android listview android-studio horizontal-scrolling horizontalscrollview

嗨,我想创建一个水平 ScrollView ,但它显示为垂直的。你能帮忙吗?

<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>

出现的内容如下:

enter image description here

请帮忙。谢谢。

最佳答案

您正在 ScrollView 内部使用 ListView,这将不起作用。

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

更多内容请看这里: Horizontal ListView in Android?

关于Android Horizo​​ntalScrollView 显示为 Vertical,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48203591/

相关文章:

java - Android程序连接错误

java - Android 开发字符串数组资源太大,导致 Android 应用程序崩溃!

android - 加入具有相同主键但不同数据的两个表

java - 使用 ListView 制作工具栏动画

java - 图像按钮消失

android - 通过滚动同步 2 个 ListView

c# - 将 ListView 项目文本颜色设置为黑色 - Android C# Xamarin

Android Studio Preview 4.1 数据库检查器使应用程序崩溃

android-studio - SDK 构建工具版本 (23.0.1) 对于项目 ':app' 来说太低。最低要求为 25.0.0

android - Android Studio 中 *.apk 的发布版本