title: keep aspect ratio of background image (android)
body: <p>I have a background image which should be scaled on the height, but keep its aspect ratio. I tried it with this code:</p>
  <pre><code>&lt;ImageView
          android:id=&quot;@+id/iv_background&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:scaleType=&quot;centerCrop&quot;
          android:src=&quot;@drawable/bg&quot; /&gt;
  </code></pre>
  <p>This works on phones in portrait mode, but when I test it on a tablet (default landscape), it scales the width and cuts the image on top and bottom. Is this because of the xml code or because of the landscape?</p>