---
title: "Android ScrollView Control"  
description: "Scrollview is used to define the content on the screen. It provides the platform in which content is adjustable according to the content display in a"  
author: "Nitish Kesarwani"  
published: 2018-01-02  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/12755/android-scrollview-control  
category: "android apps"  
tags: ["xml", "android", "java", "android styles", "android activity"]  
reading_time: 5 minutes  

---

# Android ScrollView Control

##### ScrollView in Android

Scrollview is used to define the content on the screen. It provides the [platform](https://www.mindstick.com/articles/13080/wikipedia-the-most-powerful-advertising-platform-of-the-digital-age) in which content is adjustable according to the content display in a view. ScrollView has several [attributes](https://www.mindstick.com/articles/13105/2-attributes-that-make-your-odoo-ecommerce-theme-productive-and-engaging) and methods which is helpful in developing the [interactive](https://answers.mindstick.com/qa/38931/who-has-won-the-2016-fifa-interactive-world-cup-fiwc) [user interface](https://www.mindstick.com/blog/302016/what-is-user-interface-and-what-are-its-benefits) and data.

##### Attributes

• **[Android](https://www.mindstick.com/articles/1567/navigation-drawer-implementation-in-android): viewport:** It defines the content is either filled to the Viewport or not.

##### Methods

**• arrowScroll():** it provides [Up and down](https://www.mindstick.com/forum/160255/what-is-the-significance-of-the-up-and-down-methods-in-a-migration-file) arrow view on screen to scroll the content.

• **computeScroll():** it called by a parent to upgrade their child with maximum(x,y) coordinates for [computing](https://www.mindstick.com/blog/23070/how-to-get-a-career-in-computing) the number of scrolled event.

• **FullScroll()**: it can respond to Home/End which means it can move up and down with [immediate](https://answers.mindstick.com/qa/96807/tadarise-immediate-informal-solution-of-ed-in-men) action.

• **PageScroll() :** It can generate [response](https://yourviews.mindstick.com/view/86896/biden-s-assertive-response-to-special-counsel-critique-on-memory-strength) on PageUp/PageDown keystroke.

• **ScoreTo() :** it can provide a view in which user can move along x-axis and y-axis of a screen.

• **isViewPort() :** it checks whether the viewport is enabled.

##### Android_Manifest.xml

```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mapsample.msclient009.scrollview">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
```

##### Main_Activity.xml

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.mapsample.msclient009.scrollview.MainActivity">

    <ScrollView
        android:id="@+id/SView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <LinearLayout
        android:background="#F0E991"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:padding="20dp"
            android:id="@+id/tv1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textSize="20dp"
            android:textColor="#FF0066"
            android:text="RED"/>
              <TextView
                  android:padding="20dp"
                  android:textColor="#199119"
                  android:textSize="20dp"
                  android:text="Green"
                  android:gravity="center"
                  android:id="@+id/tv2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" />
        <TextView
            android:padding="20dp"
            android:textColor="#0090FF"
            android:textSize="20dp"
            android:text="Blue"
            android:gravity="center"
            android:id="@+id/tv3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <TextView
            android:padding="20dp"
            android:textColor="#000"
            android:textSize="20dp"
            android:text="Black"
            android:gravity="center"
            android:id="@+id/tv4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <Button
                     android:padding="20dp"
                     android:background="#A9DFAD"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:id="@+id/btn"
                     android:text="First"/>
        <Button
            android:padding="20dp"
            android:background="#999989"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btn1"
        android:text="second"/>
        <Button
            android:padding="20dp"
            android:background="#FF90AA"
            android:id="@+id/button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Third" />
        <Button
            android:padding="20dp"
            android:background="#11AAFF"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/btn3"
            android:text="fourth"/>
        <Button
            android:padding="20dp"
            android:background="#22AA22"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/btn4"
            android:text="fifth"/>
    </LinearLayout>
    </ScrollView>
</LinearLayout>
```

Main_Activity.java\

```
package com.mapsample.msclient009.scrollview;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate ( savedInstanceState );        setContentView ( R.layout.activity_main );    }}
```

![Android ScrollView Control](https://www.mindstick.com/mindstickarticle/80712bae-a715-4a68-82aa-5c9cbc15d977/images/dfd2671e-3f41-4e88-9762-11127952d70c.png)

---

Original Source: https://www.mindstick.com/articles/12755/android-scrollview-control

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
