Android TextView text Beyond one screen cannot display other text solutions

Source: Internet
Author: User

On Android above let TextView too much text implementation has scroll bar, before want to simply think that set textview properties can be implemented, the result or need to use ScrollView, in order to achieve the effect of the scroll bar two ways to achieve,

One is the layout of code-written Java:

01.relativelayout.layoutparams param = new Relativelayout.layoutparams (80,80);  02.//initialization of the scrollbar control  03.ScrollView ScrollView =new ScrollView (this);  04.scrollview.setscrollcontainer (true);  05.scrollview.setfocusable (true);  06.//initialization of text control  07.TextView TextView = new TextView (this);  08.textview.sethorizontallyscrolling (true);  09.textview.settext ("hahaha, \ n hahaha");  11.scrollview.addview (textView);  12.main_view.addview (ScrollView, param);  

The other is implemented with Layout.xml:

01.<ScrollViewandroid:layout_width.= "Fill_parent"android:layout_height.= "Fill_parent"Android:scrollbars.= "vertical"Android:fadingedge.= "vertical">06.07. <TextViewAndroid:id.= "@+id/textview"android:layout_width.= "Wrap_content"Ten. Android:layout_height= "Wrap_content"Android:text.= "Demo"android:textsize.= "15SP"/>.</ScrollView>  

Android TextView text Beyond one screen cannot display other text solutions

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.