Android input box with text box plus scroll bar ScrollView example _android

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.