title: Android Splash Screen: Scale Bitmap
body: <p>I'm basically using the following xml's for an Android <strong>Splash Screen</strong>: Empty activity with <code>windowBackground</code>:</p>
  
  <pre><code>&lt;style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"&gt;
      &lt;item name="android:windowBackground"&gt;@drawable/background_splash&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p><code>background_splash.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item&gt;
          &lt;color android:color="@color/defaultBackground" /&gt;
      &lt;/item&gt;
      &lt;item&gt;
          &lt;bitmap
              android:src="@drawable/logo"
              android:tileMode="disabled"
              android:gravity="center"/&gt;
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>This works fine as long the <code>logo.png</code> is smaller than the screen size. <strong>If the <code>logo.png</code> is bigger than the screen it goes beyond the screen.</strong></p>
  
  <p>I see 3 workarounds, but all have drawbacks:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/a/47266146/1349529">Setting <code>left</code>/<code>right</code> in <code>&lt;item</code>, but this requires API 23+</a></li>
  <li>Vary <code>@drawable/logo</code> for <code>xhdpi</code>, <code>xxhdpi</code> etc. but I'm using Density Split, which would break it when reusing apk's for other devices (apk sites, "Move to new device"-Apps that transfer apks etc.)</li>
  <li>Use layout with an <code>ImageView</code>, but this has an noticeable delay</li>
  </ol>
  
  <p><strong>How to do it correctly / without drawbacks?</strong></p>