how to create a drawable for a splash screen background from 2 colors?

547 views Asked by At

I'm trying to create a background for a splash screen from 2 different colors one on top of the other, each exactly half of the screen, like so:

2 colors full screen background

I have tried the following but it does not work for every device because of the specified size.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#abc123" />
        </shape>
    </item>
    <item android:top="436dp">
        <shape android:shape="rectangle">
            <solid android:color="#456def" />
        </shape>
    </item>
</layer-list>

Does anyone know of a way to create that full screen drawable background?

1

There are 1 answers

0
Sreehari K On

It is not possible to use weight/percentage dimensions in this file, you have to implement this in your layout file