Abhinav Tyagi
Abhinav Tyagi

Reputation: 5256

Android : scrollview issue

I am trying to make a large image view scrollable with a static background image. Issue I am facing is that there is lot of free space above the image view that is coming and I have to scroll down to see my image.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background_mdpi"
    android:gravity="top"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_margin="11dp"
        android:gravity="top"
        android:background="@drawable/panel" >

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            >

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="top"
                android:src="@drawable/help_screen" />
        </ScrollView>
    </LinearLayout>

</LinearLayout>

How can I get rid of this extra space and see my Image and scroll it down as it is long image.

Thanks Abhinav Tyagi

Upvotes: 0

Views: 188

Answers (2)

Simon
Simon

Reputation: 14472

See android:scaleType http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

<ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:sourceType="fitStart"
            android:src="@drawable/help_screen" />

Upvotes: 2

Abhinav Tyagi
Abhinav Tyagi

Reputation: 5256

As Simon Said:

I used android:scaleType="fitStart" in my ImageView and this resolved my issue

Upvotes: 0

Related Questions