title: ImageView size is changed when changing the image
body: <p>I have the problem that I have a layout with an <code>ImageView</code>. With <code>AsyncTask</code> I load an image from the web. It is a panorama picture. If I start up the <code>Fragment</code>, the image I load with <code>src="@drawable/pano"</code> is shown perfectly. It has full height and I can scroll through the panorama.</p>
  
  <p>As soon as the new image is loaded into the <code>ImageView</code> the imageview rescales so that the height is:</p>
  
  <p>Before the AsyncTask (Image is loaded from drawables...):</p>
  
  <p><img src="https://i.stack.imgur.com/OwtIN.png" alt="before"></p>
  
  <p>And this is after the AsyncTask loaded the image:
  <img src="https://i.stack.imgur.com/bpeKA.png" alt="after"></p>
  
  <p>Here is my xml file:</p>
  
  <pre><code>&lt;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" &gt;
  
  &lt;HorizontalScrollView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_centerInParent="true"
      android:overScrollMode="never"
      android:scrollbars="none" &gt;
  
      &lt;RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent" &gt;
  
          &lt;ImageView
              android:id="@+id/img1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_alignParentTop="true"
              android:adjustViewBounds="true"
              android:scaleType="fitCenter"
              android:src="@drawable/pano" /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/HorizontalScrollView&gt;
  </code></pre>
  
  <p></p>
  
  <p>AsyncTask Code:</p>
  
  <pre><code>public class DownloadPanorama extends
              AsyncTask&lt;ImageView, Void, Bitmap&gt; {
          ImageView imageView;
          Bitmap bm;
  
          public DownloadPanorama(ImageView mChart) {
              imageView = mChart;
          }
  
          @Override
          protected Bitmap doInBackground(ImageView... imageViews) {
              return download_Image((String) imageView.getTag());
          }
  
          @Override
          protected void onPostExecute(Bitmap result) {
              imageView.setImageBitmap(result);
          }
  
          private Bitmap download_Image(String url) {
              Bitmap bm = null;
              try {
                  URL aURL = new URL(url);
                  URLConnection conn = aURL.openConnection();
                  conn.connect();
                  InputStream is = conn.getInputStream();
                  BufferedInputStream bis = new BufferedInputStream(is);
                  bm = BitmapFactory.decodeStream(bis);
                  bis.close();
                  is.close();
              return bm;
          }
      }
  </code></pre>
  
  <p>Also happens when not using AsyncTask and only using raw setImageBitmap... So I don't know if I have to change the <code>scaleType</code> in my xml file or if I need to set it again after loading a new image? </p>