This example introduces the basic usage of ScrollView. ScrollView allows you to scroll the screen to display content greater than the screen. ScrollView is a subclass of FrameLayout. Therefore, only one sublayout is displayed in ScrollView, generally, LinearLayout with the vertical direction is used as the subview of ScrollView. ScrollView only supports vertical scrolling.
There are already many examples of ScrollView when introducing Layout:
Android ApiDemos example resolution (153): Views-> Layouts-> ScrollView-> 1. Short
Android ApiDemos example resolution (154): Views-> Layouts-> ScrollView-> 2. Long
Android ApiDemos example resolution (155): Views-> Layouts-> ScrollView-> 3. Internal Selection
[Html]
<ScrollView xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<LinearLayout
Android: orientation = "vertical"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<TextView
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scrollbar_shorttext"/>
...
<TextView
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scrollbar_shorttext"/>
</LinearLayout>
</ScrollView>
<ScrollView xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<LinearLayout
Android: orientation = "vertical"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<TextView
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scrollbar_shorttext"/>
...
<TextView
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scrollbar_shorttext"/>
</LinearLayout>
</ScrollView>