Android ListView默认是垂直滚动的,如果需要实现水平滚动,可以通过以下两种方式实现:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
</HorizontalScrollView>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
以上是实现Android ListView的水平滚动的两种方式。根据具体需求选择适合的方式进行实现。
参考链接:
领取专属 10元无门槛券
手把手带您无忧上云