Skip to content

Android Scrollable TextView | Vertical Using XML and Programmatically

To make TextView scrollable on Android you need to use a android:scrollbars properties of your TextView in your layout’s XML file.

Then use the below code in the Activity file. This method will enable scrolling on TextView.




TextView textView = (TextView) findViewById(;
        textView.setMovementMethod(new ScrollingMovementMethod());

ScrollView is needed when you want to show too long text and should fit into one screen.

Complete code of Android Scrollable TextView

Let’s build an app and demonstrates it, Here is the complete step-by-step tutorial:-

Step 1. Create an android project in android studio (Follow this tutorial: Android First Program in Android Studio).

Step 2. Open the strings.xml file.

Android Long in scroll Using XML

Step 3. Add your long text in the strings.xml file.

You can add your own text, this is only for testing purposes.

    Android Scrollable TextView
    WordPress is easy to make website without a technical knowledge person also can build the awesome websites.
15 years ago you need to learn HTML, CSS for only static website and for dynamic  or e-commerce site need more like Javascript and database.
Wordpress is free and open source content management system.
It has largest community.
You can install a WordPress within a minute in web host.
Wordpress main feature is plugins. Which extends a feature of website without hard work.
Then another feature is templets (them) can change only on one click.
Initial release date: 27 May 2003
Written in: PHP
Stable and current version : 5.0.5 (19-Dec-2018)
Top websites in WordPress : Sony Music, CNN,,,


Who used a WordPress ?

Wordpress site has written in more then 120 languages and
every day 10 thousand site created.

Why Use a WordPress?

Its a Free and open source
You will get a admin panel an editor
A very powerful
Largest community
Can use and handle different media like images, video, gif etc.
Its a search engine friendly (SEO) google like it because it done work for SEO almost 90-95%.
Wordpress easy to manage your site
It’s secure - Need some setup
Can create any type of website with WordPress.
You can also create responsive and mobile friendly site - Based on theme used
You have to just setup one time as technical aspect

How to setup

You can install WordPress on Computer or WebHost
WebHost - For if you want a available website to other (Online)
LocalHost - On your computer if you want learn WordPress and don’t want invest money in Hosting.
Get the domain name
Install the WordPress

Step 4. Add the below code in activity_main.xml

Setting the height of TextView 300dp to see how it works.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""

        android:textSize="20dp" />


Step 5. Add the below code in MainActivity.kt

For java, you can use it from the tutorial top section.

package com.eyehunts.androidscrollabletextview

import android.os.Bundle
import android.text.method.ScrollingMovementMethod

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {


Step 4. Now Run the application, in an emulator or on your Android device.

Output screenshot Android Scrollable TextView:-

Android Scrollable TextView

Download the Link and Source of Scrollable TextView Android kotlin code in Github

Do comment if you have any doubts or suggestions on this tutorial.

Note: This example (Project) is developed in Android Studio 3.3.2. Tested on Android 9 ( Android-P), compile SDK version API 28: Android 9.0 (Pie)
TargetSdkVersion=28″Coding in Kotlin

2 thoughts on “Android Scrollable TextView | Vertical Using XML and Programmatically”

Leave a Reply

Your email address will not be published. Required fields are marked *