ScrollView is an essential component in any UI framework. Understanding and mastering this component is essential. At the point I wrote this all I needed was to scroll a text view. It looks like Android allows TextView to scroll by itself without the help of embedding it in a ScrollView control. For now you can use this document to understand how to scroll a TextView without the the help of a ScrollView. Perhaps in the future this document will be expanded for a broader coverage of ScrollView.

android how to scroll textview

Search for: android how to scroll textview

ScrollView api

ScrollingMovementMethod

Search for: ScrollingMovementMethod

ScrollingMovementMethod api

working with scrollbar views

scrollbarAlwaysDrawVerticalTrack

Search for: scrollbarAlwaysDrawVerticalTrack

see this about fading instead

scrollbarFadeDuration

Search for: scrollbarFadeDuration

android scrollbarSize

Search for: android scrollbarSize

Sample scroll bar xml from google samples

set scrollbarFadeDuration to "0" to show scrollbar

ScrollbarSize seem to be broken for now

Reporting to be available in the future.


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="fill"
    >
<TextView android:id="@+id/textViewId"  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:background="@android:color/white"
    android:text="@string/hello"
    android:textColor="@android:color/black"
    android:textSize="@dimen/medium_size"
    android:scrollbars="vertical"
    android:scrollbarStyle="insideOverlay"
    android:scrollbarSize="25dip"
    android:scrollbarFadeDuration="0"
    />
</LinearLayout>

TextView tv = this.getTextView();
tv.setMovementMethod(new ScrollingMovementMethod());
or
tv.setMovementMethod(ScrollingMovementMethod.getInstance());

In Android how do I programatically tell a textview to scroll up

Search for: In Android how do I programatically tell a textview to scroll up

Here is an SOF discussion

android textview scroll to bottom

Search for: android textview scroll to bottom

Use this SOF reference

Use this one instead


Just set the android:gravity="bottom" on the text view

Alternatively you can embed the textview in a scrollview

At some point in all UI you have to master the ScrollView!!