我以为改变 ScrollView 的滚动方向只需要改变内部 LinearLayout 的方向就行,可是滚不动,找了很多资料都没解决。
<ScrollView
android:layout_width="match_parent"
android:layout_height="100sp"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="80sp"
android:orientation="horizontal"
android:padding="10sp" />
</ScrollView>
最后终于翻到了一篇:https://juejin.im/post/5d5e8b30518825731553afe6,水平滚动必须用 HorizontalScrollView!
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="100sp"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="80sp"
android:orientation="horizontal"
android:padding="10sp" />
</HorizontalScrollView>