I am trying to add a bitmap as a Splash Screen. I have created a separate Splash Theme and added android:windowBackground to a Layer list drawable containing that bitmap.
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/splash_bg</item>
</style>
Following is the code for my layer list drawable(@drawable/splash_bg):
<layer-list>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash" />
</item>
</layer-list>
Currently the drawable looks like this:

I want to remove the extra padding around the image, without streching the image. Some thing like Center Crop in ImageView.
If the center crop is not possible, then i would like to make it fit horizontally(without stretching), and show a solid background at the top and bottom.
So far I have tried all the attributes of gravity, and tried using the inset tag, but all of them seem to be stretching the image.
windowBackgroundisn't best way to set up such image (splash), it probably should be used only withcolor(if withbitmapthen withtileMode="repeat"in some cases). there is no reliable way to set up different bitmaps for different screen resolutions/ratios. it would be the best to setImageViewwith properscaleType,CENTER_CROPseems to be the best option