Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android rectangle shape with two different color

rectangle shape

how can I create rectangle shape by using two different colors with shadow? like above image.

like image 664
Prithiv Dharmaraj Avatar asked Oct 23 '25 16:10

Prithiv Dharmaraj


1 Answers

Please create a drawable file and put the below code in it.

    <?xml version="1.0" encoding="utf-8"?>
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
            <item>
                <shape android:shape="rectangle" >
                    <size android:height="20dp" />
                    <solid android:color="#F66D08" />
                </shape>
            </item>
            <item android:top="50dp">
                <shape android:shape="rectangle" >
                    <gradient android:endColor="#AD1B1D"
                        android:startColor="#E2360A"
                        android:angle="270" />
                </shape>
            </item>
        </layer-list>
like image 90
Anish Kumar Dubey Avatar answered Oct 25 '25 05:10

Anish Kumar Dubey