Splash Screen Background for 18:9 Aspect Ratio (Samsung Galaxy S8)

Viewed 2478

I have implemented a splash screen in android with a full image background using a drawable resource. This displays correctly on traditional screen aspect ratios. When I now run it in Samsung Galaxy S8 which has an aspect ratio of 18:9, the background image get's stretched vertically.

I shy away from using a layout as my splash screen as there will be a delay for the image to show up.

One thing I can think of is if we have a specific image sized for 18:9 but then how can I make it so that android will pick that specific image based on certain aspect ratio?

2 Answers

Use screen aspect qualifier and make a different layout for long screen devices and Android will detect it.

enter image description here

This is not a perfect answer but it works in situation where you don't care about little bit cropping of image, add

android:scaleType="centerCrop"

in imageview tag of splash xml.

Related