Pratik Patel
Pratik Patel

Reputation: 474

Scrollbar in android

How I can add scrollbar in android xml file??? Can anyone prtovide me the simple way to add it in relative layout. I tried many times to add it in relative and linear layout. But,It doesn't work. Please give me solution.

Thanks.

Upvotes: 3

Views: 1625

Answers (2)

Harpreet
Harpreet

Reputation: 3070

Reference to above answer:

HOW TO USE RELATIVE LAYOUT W.R.T. SCROLLVIEW

<ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"  >


    <RelativeLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >         
    ... ... ...

</RelativeLayout>
</ScrollView>

Upvotes: 3

Ted Hopp
Ted Hopp

Reputation: 234795

Wrap your relative or linear layout in a ScrollView. For example:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <!-- contents of linear layout go here -->
    </LinearLayout>
</ScrollView>

Upvotes: 3

Related Questions