Showing posts with label android vertical scrollview. Show all posts
Showing posts with label android vertical scrollview. Show all posts

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>

 

Copyright @ 2013 Android Developers Blog.