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 function of having a scroll bar on a text box is a must on the phone, and here's how to add a scroll bar.
To add a scroll bar, it is very simple, simply add the scroll bar control to the text input box or text display box, the control name is ScrollView, below we compare (with 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.