title: Issue when scaling image using matrix in ImageView
body: <p>I have the following snippet of code in the onCreate method of a class that extends Activity:</p>
  
  <pre><code> ImageView view = (ImageView) findViewById(R.id.ImageView01);
  
  BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options();
  bmpFactoryOptions.inJustDecodeBounds = true;
  Bitmap bmp = BitmapFactory.decodeResource(getResources(),
  R.drawable.sample_landscape, bmpFactoryOptions);
  
  Display display = getWindowManager().getDefaultDisplay();
  int width = display.getWidth();
  int height = display.getHeight();
  
  Log.v("IMAGEVIEWERMATRIX", "Display Width: " + display.getWidth());
  Log.v("IMAGEVIEWERMATRIX", "Display Height: " + display.getHeight());
  
  Log.v("IMAGEVIEWERMATRIX", "BMP Width: " + bmpFactoryOptions.outWidth);
  Log.v("IMAGEVIEWERMATRIX", "BMP Height: " + bmpFactoryOptions.outHeight);
  
  if (bmpFactoryOptions.outWidth &gt; width || bmpFactoryOptions.outHeight &gt; height) {
      float heightRatio = (float) height / (float) bmpFactoryOptions.outHeight;
      float widthRatio = (float) width / (float) bmpFactoryOptions.outWidth;
  
      // WHY
      heightRatio = heightRatio / 1.5f;
      widthRatio = widthRatio / 1.5f;
  
      Log.v("IMAGEVIEWERMATRIX", "heightRatio:" + heightRatio);
      Log.v("IMAGEVIEWERMATRIX", "widthRatio: " + widthRatio);
  
      float scale = widthRatio;
      if (heightRatio &lt; widthRatio) {
          scale = heightRatio;
      }
  
      matrix.setScale(scale, scale);
      Log.v("IMAGEVIEWERMATRIX", "Scale: " + scale);
  } else {
      Log.v("IMAGEVIEWERMATRIX", "NOTNOTNOT");
      matrix.setTranslate(1f, 1f);
  }
  
  Bitmap realBmp = BitmapFactory.decodeResource(getResources(),
  R.drawable.sample_landscape);
  view.setImageBitmap(realBmp);
  view.setImageMatrix(matrix);
  </code></pre>
  
  <p>When I run it, the image appears on screen scaled to fit correctly.  My issue is that I have to adjust the scale by 1.5 in order for this to be correct.</p>
  
  <pre><code>heightRatio = heightRatio / 1.5f;
  widthRatio = widthRatio / 1.5f;
  </code></pre>
  
  <p>My intuition is that this has to do with the display density of the device but for the life of me, I can't wrap my head around why I would need to do this.</p>
  
  <p>Here is the layout XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  &lt;ImageView android:id="@+id/ImageView01" android:scaleType="matrix"     android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/ImageView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>