I tried to create splash screen following this https://www.bignerdranch.com/blog/splash-screens-the-right-way/, where a custom theme of the main activity is used to show the splash screen.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/gray"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>
But I need to use an image for the background in the layer-list item of the theme instead of a solid color. The problem is, as many have pointed out elsewhere, there seems no way to have that background image scaled proportionately center cropped filling the screen like what you can do with ImageView in a layout. I tried to create a new bitmap drawable using the original one programatically based on the screen dimensions, then replace the original drawable. This however doesn't work since the main activity theme shows up immediately after launch and well before the application's constructor, or the activity's constructor or their onCreate get called. Is there anyway to replace that drawable before the windowBackground of the main activity theme shows up on screen?