title: How to get ImageView scale to fill the layout as much as the width permits
body: <p>What I want is for the ImageView to scale with the same ratio to fill the layout without being cropped. Since the width is going to match first, effectively, this means scaling until the width is maximized.</p>
  
  <p>My code is:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_display);
      ImageView img = findViewById(R.id.displayImg);
      img.setImageBitmap(bmp); // bmp is a public static Bitmap set by another class
      img.setRotation(90);
      img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
  }
  </code></pre>
  
  <p>My layout is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
     &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/displayImg" /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>As per <a href="https://robots.thoughtbot.com/android-imageview-scaletype-a-visual-guide" rel="nofollow noreferrer">Android ImageView ScaleType: A Visual Guide</a> <code>CENTER_INSIDE</code> should</p>
  
  <blockquote>
    <p>Scale the image uniformly (maintain the image’s aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).</p>
  </blockquote>
  
  <p>The black image is what I'm currently, and I've drawn what I believe I <em>should</em> be seeing instead (as you can tell, I'm the modern-day Michelangelo).
  <a href="https://i.stack.imgur.com/k0vHu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k0vHu.png" alt="image"></a></p>