When Android TextView too much text, it displays extra content through the scroll bar.

Source: Internet
Author: User
<span id="Label3"></p><p><p>Method One:</p></p><p><p>TextView text too much, show not all, how to do? We can add scroll bars for TEXTVIEW.</p></p><pre><pre><span style="color: #0000ff;"><</span> <span style="color: #800000;">TextView </span> <span style="color: #ff0000;">Android:id</span> <span style="color: #0000ff;">= "@+id/bus_detail_content"</span> <span style="color: #ff0000;"> android:layout_width</span><span style="color: #0000ff;">= "fill_parent"</span><span style="color: #ff0000;"> android:layout_height</span><span style="color: #0000ff;">= "fill_parent "</span><span style="color: #ff0000;"> android:textcolor</span><span style="color: #0000ff;">=" #000000 "</span><span style="color: #ff0000;"> android:scrollbars</span><span style="color: #0000ff;">=" Vertical "</span><span style="color: #ff0000;"> android:singleline</span><span style="color: #0000ff;">=" false "</span> <span style="color: #0000ff;">/></span></pre></pre><p><p>The activity adds code for</p></p><pre><pre>busdetailcontent=<span style="color: #000000;">(TextView) Findviewbyid (r.id.bus_detail_content); Busdetailcontent.setmovementmethod ( Scrollingmovementmethod.getinstance ());</span></pre></pre><p><p></p></p><p><p></p></p><p><p>Method Two:</p></p><p><p>Pure XML</p></p><pre><span style="color: #0000ff;"><span style="color: #0000ff;"><</span></span><span style="color: #800000;"><span style="color: #800000;">ScrollView</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">xmlns:android</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "http://schemas.android.com/apk/res/android"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:layout_width</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "fill_parent"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:layout_height</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "fill_parent"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:scrollbars</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "vertical"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:fadingedge</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "vertical"</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">></span></span> <span style="color: #0000ff;"><span style="color: #0000ff;"><</span></span><span style="color: #800000;"><span style="color: #800000;">TextView</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:layout_width</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "fill_parent"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:layout_height</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "wrap_content"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:id</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "@+id/text_view"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:textcolor</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "#071907"</span></span><span style="color: #ff0000;"><span style="color: #ff0000;">Android:paddingtop</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">= "5dip"</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">/></span></span> <span style="color: #0000ff;"><span style="color: #0000ff;"></</span></span><span style="color: #800000;"><span style="color: #800000;">ScrollView</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">></span></span> </pre><p><p></p></p><p><p>When Android TextView too much text, it displays extra content through the scroll bar.</p></p></span>

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.