Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make drawable do centerCrop in layer-list

all.

I want to make splashscreen:

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/background_splash</item>
</style>

drawable/background_splash:

<?xml version="1.0" encoding="utf-8"?>

<item
    android:drawable="@color/main_theme"/>

<item android:bottom="16dp">
    <bitmap
        android:gravity="center|fill_horizontal"
        android:src="@drawable/splash_logo"
        />
</item>

<item android:bottom="16dp">
    <bitmap
        android:gravity="bottom"
        android:src="@drawable/logo"/>
</item>

But I have no ability to make bitmap with android:src="@drawable/splash_logo" resize as centerCrop scale in ImageView( I need my bitmap fill all width) For now it's size as size in resource in pixels. If i make it much larger it will be larger the screen. I tried scale drawable and no sense.

Do you have any suggestions?

like image 779
Yurii Kot Avatar asked Aug 22 '16 14:08

Yurii Kot


1 Answers

I was able to achieve filling screen, but keep in mind, it will be a bit stretched on 18:9 screens

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/splash_2_x2"
        android:top="0dp"
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"/>
</layer-list>
like image 189
Dima Rostopira Avatar answered Sep 25 '22 10:09

Dima Rostopira