title: Resizing ImageView to fit to aspect ratio
body: <p>I need to resize an ImageView such that it fits to the screen, maintains the same aspect ratio. The following conditions hold:</p>
  
  <ul>
  <li>Images are a fixed width (size of the width of screen)</li>
  <li>Images are downloaded from the Internet, i.e. size can only be determined later</li>
  <li>Aspect ratio for each image will vary; some are tall, some are square, some are flat</li>
  <li>ImageView's <em>height</em> needs to change, either bigger or smaller based on the aspect ratio of the </li>
  <li>Excess height is cropped, can't have a lot of empty space like it is by default.</li>
  </ul>
  
  <p>For example, a tiny 50x50 image on a 400 px width screen would scale the image up to 400x400 px. A 800x200 image would scale to 400x100.</p>
  
  <p>I've looked at most of the other threads, and many proposed solutions like simply changing <code>adjustViewBounds</code> and <code>scaleType</code> will only scale down an image, and not scale it up.</p>