当使用ScrollView时,只能上下滑动,而使用HorizontalScrollView时只能左右滑动,所以当即需要左右也需要上下滑动时,可以在ScrollView里边再套一个HorizontalScrollView,这样就可以实现了。
例:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mainActivity_code"/>
</HorizontalScrollView>
</ScrollView>