Alexiz Hernandez Alexiz Hernandez - 3 years ago 152
Android Question

How to create multi-colored shape background in Android activity

I am looking to make my

's background into two colours. A custom color on top and a white colour on the bottom. The thing is I don't want to separate them with a horizontal line. I would like to create something very similar to the image provided. I really wouldn't know where to start to create this...

enter image description here

I tried this, but again, I don't really want to have a horizontal separation. I would prefer a separation more like the image.

Here's what I've tried so far.

<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="">
<shape android:shape="rectangle">
<solid android:color="#FAFAFA" />
<item android:bottom="300dp" android:top="0dp" android:left="0dp" android:right="0dp">
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimary" />

Answer Source

You need something like this as a background of your layout.

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android=""
        android:pathData="M0,0 L0,50 L500,80 L500,0 z" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download