Notes ScrollView (Scroll View) class:

By default, the content will not be displayed if the content exceeds the screen range. The android layout manager itself does not provide the function of scrolling the screen, so there is a ScrollView component that supports scrolling the screen. The
ScrollView class is a subclass of android.widget.FrameLayout (frame layout manager) , You can add any component you want to put in the scroll view, but a scroll view can only place one component, if you want to place multiple, you can place a frame layout manager in the scroll view, and then place the other multiple Components placed in the layout manager
ScrollView class only supports vertical scrolling, if you want to achieve horizontal scrolling, you can use the HorizontalscrollView class to achieve

Method to add scroll view:
a) Add in the XML layout file

<ScrollView
android:id = “”
android:layout_widht = “”
android:layout_height = “”
…>
//要添加的滚动条的组件
			</ScrollView>

b) Created by the new keyword

a) Use the construction method ScrollView (Context context) to create a scroll view
b) Create or obtain the component that needs to add a scroll bar, and apply the addView() method to add it to the scroll view
c) Add the scroll view to the entire layout manager , Used to display the scroll view

Guess you like

Origin blog.csdn.net/qq_42823109/article/details/94360323
Recommended