TextView in Android development with too much content to set scroll bars

Source: Internet
Author: User
1. In Android, the content in TextView often causes us to be unable to browse, so we can add scrollbars for TextView to navigate through the entire contents of TextView through the scroll bar.
2. Add a vertical scroll bar to the TextView layout file:
android:scrollbars= "Vertical"
Example:
 
<textview
	android:id= "@+id/tv_notecontent"
	android:layout_width= "match_parent"
	android:layout_ height= "Wrap_content"
	android:minlines= "android:paddingtop=" "
	3dip"
	android:textcolor= "#603912"
	android:scrollbars= "vertical"
	android:textsize= "19sp"/>
3.  You also need to add in the Java file:
Textview.setmovementmethod (Scrollingmovementmethod.getinstance ());
Example:
 
Private TextView tv_content = null;

Tv_content = (TextView) This.findviewbyid (r.id.tv_notecontent);
Tv_content.setmovementmethod (Scrollingmovementmethod.getinstance ());
4. OK, Enjoy it!!!
Related Article

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.