0
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" 
    android:background="@drawable/background">

    <ImageView
        android:id="@+id/iv_bollywood"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="94dp"
        android:src="@drawable/bollywood" />

    <ImageView
        android:id="@+id/iv_hollywood"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_bollywood"
        android:layout_below="@+id/iv_bollywood"
        android:layout_marginTop="14dp"
        android:src="@drawable/hollywood" />

    <ImageView
        android:id="@+id/iv_animated"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_hollywood"
        android:layout_below="@+id/iv_hollywood"
        android:layout_marginTop="14dp"
        android:src="@drawable/animated" />

    <ImageView
        android:id="@+id/iv_hindhi_dub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
              android:layout_alignLeft="@+id/iv_animated"
        android:layout_below="@+id/iv_animated"
        android:layout_marginTop="14dp"
        android:src="@drawable/hindidub" />

    <ImageView
        android:id="@+id/iv_other"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_hindhi_dub"
        android:layout_below="@+id/iv_hindhi_dub"
        android:layout_marginTop="14dp"
        android:src="@drawable/other" />

        </RelativeLayout>


i am  new in android.i want to  add scroll in my application.

i want to use scrollview in my imageview.i want both horizontal and vertical scroll view in my application,how can i do this.please help me and give me any code example related to my application.thankyou...:)

Rajshree Tiwari
  • 630
  • 1
  • 7
  • 27
  • check this link : http://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android – Shankar Oct 30 '13 at 05:38

3 Answers3

2
    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        >

        <RelativeLayout
            android:layout_width="318dp"
            android:layout_height="495dp"
             >

<ImageView
        android:id="@+id/iv_bollywood"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="94dp"
        android:src="@drawable/bollywood" />

    <ImageView
        android:id="@+id/iv_hollywood"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_bollywood"
        android:layout_below="@+id/iv_bollywood"
        android:layout_marginTop="14dp"
        android:src="@drawable/hollywood" />

    <ImageView
        android:id="@+id/iv_animated"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_hollywood"
        android:layout_below="@+id/iv_hollywood"
        android:layout_marginTop="14dp"
        android:src="@drawable/animated" />

    <ImageView
        android:id="@+id/iv_hindhi_dub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
              android:layout_alignLeft="@+id/iv_animated"
        android:layout_below="@+id/iv_animated"
        android:layout_marginTop="14dp"
        android:src="@drawable/hindidub" />

    <ImageView
        android:id="@+id/iv_other"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/iv_hindhi_dub"
        android:layout_below="@+id/iv_hindhi_dub"
        android:layout_marginTop="14dp"
        android:src="@drawable/other" />

        </RelativeLayout>
</ScrollView >

You have to make ScrollView as Parent (Vertical Scroll)...

Looking Forward
  • 3,579
  • 8
  • 45
  • 65
0
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background">

<ImageView
    android:id="@+id/iv_bollywood"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="94dp"
    android:src="@drawable/bollywood" />

<ImageView
    android:id="@+id/iv_hollywood"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/iv_bollywood"
    android:layout_below="@+id/iv_bollywood"
    android:layout_marginTop="14dp"
    android:src="@drawable/hollywood" />

<ImageView
    android:id="@+id/iv_animated"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/iv_hollywood"
    android:layout_below="@+id/iv_hollywood"
    android:layout_marginTop="14dp"
    android:src="@drawable/animated" />

<ImageView
    android:id="@+id/iv_hindhi_dub"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/iv_animated"
    android:layout_below="@+id/iv_animated"
    android:layout_marginTop="14dp"
    android:src="@drawable/hindidub" />

<ImageView
    android:id="@+id/iv_other"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/iv_hindhi_dub"
    android:layout_below="@+id/iv_hindhi_dub"
    android:layout_marginTop="14dp"
    android:src="@drawable/other" />

</RelativeLayout>
</ScrollView>
anand
  • 416
  • 2
  • 11
0
<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <HorizontalScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="50dp" >

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/background" >

                <ImageView
                    android:id="@+id/iv_bollywood"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="94dp"
                    android:src="@drawable/bollywood" />

                <ImageView
                    android:id="@+id/iv_hollywood"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/iv_bollywood"
                    android:layout_below="@+id/iv_bollywood"
                    android:layout_marginTop="14dp"
                    android:src="@drawable/hollywood" />

                <ImageView
                    android:id="@+id/iv_animated"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/iv_hollywood"
                    android:layout_below="@+id/iv_hollywood"
                    android:layout_marginTop="14dp"
                    android:src="@drawable/animated" />

                <ImageView
                    android:id="@+id/iv_hindhi_dub"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/iv_animated"
                    android:layout_below="@+id/iv_animated"
                    android:layout_marginTop="14dp"
                    android:src="@drawable/hindidub" />

                <ImageView
                    android:id="@+id/iv_other"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/iv_hindhi_dub"
                    android:layout_below="@+id/iv_hindhi_dub"
                    android:layout_marginTop="14dp"
                    android:src="@drawable/other" />
            </RelativeLayout>
        </HorizontalScrollView>

        </ScrollView>

Try this one for Horizontal as well as Vertical scrollview

Looking Forward
  • 3,579
  • 8
  • 45
  • 65
  • you can edit your original post instead of posting a new answer – Raghunandan Oct 30 '13 at 05:45
  • pls check this https://groups.google.com/forum/#!topic/android-developers/xQrL5o7JgXQ and this https://groups.google.com/forum/#!topic/android-beginners/wFklrKdHnRg/ See the quote by Romain Guy. Romain Guy and Dianne hackborn work for google – Raghunandan Oct 30 '13 at 05:52