vaibvorld
vaibvorld

Reputation: 389

how to use horizontalscroll view component?

i want to create a horizontal scroll view just like the one shown in imagehorizontal scroll view

In android widgets i found Horizontal Scroll View widget in composite section but dont know how to use it.Please help

Upvotes: 1

Views: 100

Answers (1)

agp
agp

Reputation: 76

Create xml file and add HorizontalScrollView first then add one layout to this as child. Then you can add any no. of views to the newly added child, that makes entire things scroll.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <HorizontalScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
            <!--  child views here -->
        </RelativeLayout>
    </HorizontalScrollView>
</LinearLayout>

Upvotes: 2

Related Questions