title: How to convert layout to drawable for use in splash screen
body: <h1>Background information</h1>
  
  <p>When a user enters my Android application. They are first taken to <code>LoginActivity</code>. <code>LoginActivity</code> takes some time to load as it is also responsible for performing background sqlite migrations as well as other housekeeping tasks (this takes 500-1000ms).</p>
  
  <p>Unfortunately, the user sees a blank screen during this entire time. As <code>setContentView</code> has not executed yet.</p>
  
  <p>I am trying to remediate this problem by following the guides</p>
  
  <ul>
  <li><a href="https://android.jlelse.eu/launch-screen-in-android-the-right-way-aca7e8c31f52" rel="nofollow noreferrer">https://android.jlelse.eu/launch-screen-in-android-the-right-way-aca7e8c31f52</a></li>
  <li><a href="https://www.bignerdranch.com/blog/splash-screens-the-right-way/" rel="nofollow noreferrer">https://www.bignerdranch.com/blog/splash-screens-the-right-way/</a></li>
  </ul>
  
  <p>They tell me I need to create a <code>background_splash.xml</code> in drawables and point to it using a custom style with <code>&lt;item name="android:windowBackground"&gt;@drawable/background_splash&lt;/item&gt;</code></p>
  
  <p>Unfortunately I noticed that I am not able to control <code>padding</code> <code>margin</code> <code>width</code> <code>height</code>, <code>gravity</code> of my logo in drawables.</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
          android:drawable="@color/gray"/&gt;
  
          &lt;!-- cant control android:margin=... (my min API is 21) --&gt;
          &lt;!-- cant control android:width=...  (my min API is 21) --&gt;
          &lt;!-- cant control android:height=... (my min API is 21) --&gt;
      &lt;item&gt;
          &lt;bitmap
              android:gravity="center"
              android:src="@mipmap/ic_launcher"/&gt;
      &lt;/item&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <h2>My problem</h2>
  
  <p>How to properly achieve same behavior (or at least similar) as my current <code>activity_login.xml</code> file and convert that into a drawable?</p>
  
  <h2>My code</h2>
  
  <p><a href="https://i.stack.imgur.com/lDMC7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lDMC7.png" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.LinearLayoutCompat
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
  
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/material_red_500"&gt;
  
      &lt;!--***********************************************************
      * Layout section: The login logo
      ************************************************************--&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"&gt;
  
          &lt;android.support.v7.widget.AppCompatImageView
              android:layout_centerInParent="true"
  
              android:src="@drawable/image_symbol_lock"
              android:scaleType="fitCenter"
  
              android:layout_width="150dp"
              android:layout_height="150dp"/&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;!--***********************************************************
      * Layout section: The login button (facebook)
      ************************************************************--&gt;
      &lt;android.support.v7.widget.AppCompatTextView
          android:id="@+id/button_facebook"
  
          android:paddingTop="28dp"
          android:paddingStart="16dp"
          android:paddingEnd="16dp"
          android:paddingBottom="28dp"
          android:background="@color/material_blue_500"
  
          android:text="LOG IN"
          android:textSize="32sp"
          android:textColor="@color/white"
  
          android:gravity="center_horizontal"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"/&gt;
  
  &lt;/android.support.v7.widget.LinearLayoutCompat&gt;
  </code></pre>