Tuesday, 12 March 2013

ScrollView in android | horizontal scroll view in android | scroll image horizonatlly and vertically both


Hello friends,

Using the following xml code you can scroll an image in both horizontally and vertically.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
    android:orientation="vertical" >

       <ScrollView
         android:id="@+id/ScrollView01"
         android:layout_width="wrap_content"
         android:layout_height="320px"
         android:layout_below="@+id/buttonlayout"
         android:scrollbars="horizontal|vertical" >

        <HorizontalScrollView
            android:id="@+id/HorizontalScrollView01"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent" >

            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/linearMain3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageDetail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:scaleType="fitXY" />
            </LinearLayout>
        </HorizontalScrollView>
    </ScrollView>
</RelativeLayout>

Mukesh Yadav

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

1 comments:

  1. Hi thats very nice tutorial on scrollview concept in android you can also check the one at
    android scrollview

    android styled scrollview

    ReplyDelete

 

Copyright @ 2013 Android Developer Blog.

Blog Widget by LinkWithin