Android splash screen without logo distortion -
is possible create splash screen logo maintains aspect ratio while background image can resized independently? i'm using several .png files different resolutions , great on devices. however, there few phones distort logo severely (i.e. samsung s8, move vertical screen space).
i can deal distortion splash screen background, skinny/squashed logo unacceptable. know how this? , vector drawable logo better .png new layout?
if have portrait image splash screen, here's solution full screen on portrait, , centred not cropped on edit: portrait landscape:
splash_screen.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutsplash" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/splash_screen_background"> <imageview android:contentdescription="@string/splash_screen_description" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical" style="@style/splashscreen" /> </linearlayout> values/styles.xml
<style name="splashscreen"> <item name="android:src">@drawable/splash</item> <item name="android:adjustviewbounds">true</item> <item name="android:scaletype">fitcenter</item> </style> values-port/styles.xml
<style name="splashscreen"> <item name="android:src">@drawable/splash</item> <item name="android:adjustviewbounds">true</item> <item name="android:scaletype">centercrop</item> </style>
Comments
Post a Comment