title: Android ScrollView adds extra padding on top and bottom of child imageview
body: <p>I have a problem with rendering a ScrollView. Essentially, the layout is fixed header and footer with a scrollview in the middle. The idea is that when the screen keyboard is activated for the content EditText the image can be scrolled if the height of the image is longer than the middle view.</p>
  
  <p>In testing the layout, I've found that on my Android phone (Xperia X10 Android 1.6) there is a whole heap of padding added to the top and bottom of the ImageView.</p>
  
  <p>I'd appreciate any suggestions as to how I can prevent this from happening.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
      &lt;!-- Header --&gt;
      &lt;RelativeLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="#FFFFFF"&gt;
          &lt;TextView
              android:text="Share your photo"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="left"/&gt;
          &lt;Button
              android:id="@+id/btnStack"
              android:text="Stacks"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;!-- End Header --&gt;
  
  
      &lt;!-- Body --&gt;
      &lt;ScrollView
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:padding="5px"
          android:background="#CCCCCC"&gt;
          &lt;ImageView
              android:id="@+id/imgPreview"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"/&gt;
      &lt;/ScrollView&gt;
      &lt;!-- End Body --&gt;
  
  
      &lt;!-- Footer --&gt;
      &lt;RelativeLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="#FFFFFF"
          android:layout_alignParentBottom="true"&gt;
          &lt;EditText
              android:id="@+id/caption"
              android:text="Type your caption"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"/&gt;
  
          &lt;LinearLayout
              android:orientation="horizontal"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/caption"
              android:background="#CCCCCC"&gt;
              &lt;Button
                  android:id="@+id/btnUpload"
                  android:text="Share"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"/&gt;
              &lt;Button
                  android:id="@+id/btnCancel"
                  android:text="Cancel"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"/&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/RelativeLayout&gt;
      &lt;!-- End Footer --&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>