title: Scale Image to fill ImageView width and keep aspect ratio
body: <p>I have a <code>GridView</code>. The data of <code>GridView</code> is request from a server.</p>
  
  <p>Here is the item layout in <code>GridView</code>:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/analysis_micon_bg"
      android:gravity="center_horizontal"
      android:orientation="vertical"
      android:paddingBottom="@dimen/half_activity_vertical_margin"
      android:paddingLeft="@dimen/half_activity_horizontal_margin"
      android:paddingRight="@dimen/half_activity_horizontal_margin"
      android:paddingTop="@dimen/half_activity_vertical_margin" &gt;
  
      &lt;ImageView
          android:id="@+id/ranking_prod_pic"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:adjustViewBounds="true"
          android:contentDescription="@string/app_name"
          android:scaleType="centerCrop" /&gt;
  
      &lt;TextView
          android:id="@+id/ranking_rank_num"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          android:id="@+id/ranking_prod_num"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          android:id="@+id/ranking_prod_name"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I request data from server, get image url and load image to <code>Bitmap</code></p>
  
  <pre><code>public static Bitmap loadBitmapFromInputStream(InputStream is) {
      return BitmapFactory.decodeStream(is);
  }
  
  public static Bitmap loadBitmapFromHttpUrl(String url) {
      try {
          return loadBitmapFromInputStream((InputStream) (new URL(url).getContent()));
      } catch (Exception e) {
          Log.e(TAG, e.getMessage());
          return null;
      }
  }
  </code></pre>
  
  <p>and there is the code of <code>getView(int position, View convertView, ViewGroup parent)</code> method in adapter</p>
  
  <pre><code>Bitmap bitmap = BitmapUtil.loadBitmapFromHttpUrl(product.getHttpUrl());
  prodImg.setImageBitmap(bitmap);
  </code></pre>
  
  <p>The image size is <code>210*210</code>. I run my application on my Nexus 4. The image does fill <code>ImageView</code> width, but the <code>ImageView</code> height does not scale. <code>ImageView</code> does not show the whole image.</p>
  
  <p>How do I solve this problem?</p>