When Android TextView too much text, it displays extra content through the scroll bar.
Last Update:2015-04-30
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>