How to Make Scrollable TextView in Android

Android TextView allows user to display text in android application. In this tips, I will show how to make scrollable TextView in android. To make TextView scrollable, you don’t need to use ScrollView, just add android:scrollbars=”vertical” attribute in TextView and then add two line of code in your java activity file.

XML Layout File

Following is the xml layout file which contain a LinearLayout and a TextView.
res/layout/scrollable_textview.xml 


Java Activity File

Following is the final code of MainActivity.java file.
src/MainActivity.java


Now, run your application and see texts are scrolling.

Output:

   

Comments

Popular posts from this blog

Best Navigation Drawer Libraries for Android Project

New trailers: Small Axe: Red White and Blue, Equinox, Sweet Home, and more

The makers of the GorillaPod made a MagSafe tripod mount