We all know that EditText and TextView are Android text input boxes and text display boxes, but based on the size of the phone screen, if you need to enter more text or display more content, the phone screen is far from enough, So the text box has a scroll bar function is necessary on the phone, to add a scroll bar, in fact, is very simple, just want to be in the text input box or text display box above the scroll bar control, the control name is ScrollView, the following we contrast (to TextView examples).
Copy Code code as follows:
A, does not add the scrolling effect
<textview
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:id= "@+id/textview"
/>
B, plus scrolling effect
<scrollview
Android:id= "@+id/scrollview"
Android:layout_width= "Fill_parent"
android:layout_height= "200px"
Android:scrollbarstyle= "Outsideoverlay" android:background= "@android:d rawable/edit_text" >
<textview
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:id= "@+id/textview"
/>
</ScrollView>
As you can see from the example above, you can have the text box function as a scrolling body by simply adding the ScrollView control to the perimeter of the text control.