Android HorizontalScrollView 显示为 Vertical
Android HorizontalScrollView appearing as Vertical
您好,我想创建一个水平滚动视图,但显示为垂直滚动视图。你能帮忙吗?
<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>
这是显示的内容:
请帮忙。谢谢
您正在 ScrollView 内部使用 ListView,这将不起作用。
如果你想要水平的ListView你需要使用RecyclerView
更多信息在这里:
Horizontal ListView in Android?
你可以使用recyclerview。
为recyclerview设置水平线性布局为layoutmanager实现水平滚动
您好,我想创建一个水平滚动视图,但显示为垂直滚动视图。你能帮忙吗?
<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>
这是显示的内容:
请帮忙。谢谢
您正在 ScrollView 内部使用 ListView,这将不起作用。
如果你想要水平的ListView你需要使用RecyclerView
更多信息在这里: Horizontal ListView in Android?
你可以使用recyclerview。 为recyclerview设置水平线性布局为layoutmanager实现水平滚动