I want to make a custom drawable in android studio using xml but could not get result that I want

49 Views Asked by At

I want to make the background of my layout in android as given below I tried in android studio using layer list and shapes but could not get result anyone expert here please help me how to make the background as given below

enter image description here

I Have tried this code but have not gotten my result. I want a background drawable.

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:topRightRadius="15dp" android:topLeftRadius="15dp"
      android:bottomRightRadius="15dp"/>
    <solid android:color="@color/white"/>
</shape>

I also use Layer list I have no idea how I can get my result

1

There are 1 best solutions below

6
AudioBubble On

Try with this

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!--Shadow Layer-->

    <item>
        <rotate
            android:fromDegrees="40"
            android:pivotX="100%"
            android:pivotY="0%"
            android:toDegrees="0">
            <shape android:shape="rectangle">
                <corners android:radius="4dp" />
                <padding
                    android:bottom="1px"
                    android:left="1px"
                    android:right="1px" />
                <solid android:color="#01000000" />
            </shape>
        </rotate>
    </item>
    <item android:right="10dp">
        <shape android:shape="rectangle">
            <corners android:radius="4dp" />
            <padding
                android:bottom="1px"
                android:left="1px"
                android:right="1px" />
            <solid android:color="#01000000" />
        </shape>
    </item>

    <!--===============-->

    <item>
        <rotate
            android:fromDegrees="40"
            android:pivotX="100%"
            android:pivotY="0%"
            android:toDegrees="0">
            <shape android:shape="rectangle">
                <corners android:radius="4dp" />
                <padding android:bottom="1px" />
                <solid android:color="#09000000" />
            </shape>
        </rotate>
    </item>
    <item android:right="10dp">
        <shape android:shape="rectangle">
            <corners android:radius="4dp" />
            <padding android:bottom="1px" />
            <solid android:color="#09000000" />
        </shape>
    </item>

    <!--===============-->

    <item>
        <rotate
            android:fromDegrees="40"
            android:pivotX="100%"
            android:pivotY="0%"
            android:toDegrees="0">
            <shape android:shape="rectangle">
                <corners android:radius="4dp" />
                <padding
                    android:bottom="1px"
                    android:left="1px"
                    android:right="1px" />
                <solid android:color="#10000000" />
            </shape>
        </rotate>
    </item>
    <item android:right="10dp">
        <shape android:shape="rectangle">
            <corners android:radius="4dp" />
            <padding
                android:bottom="1px"
                android:left="1px"
                android:right="1px" />
            <solid android:color="#10000000" />
        </shape>
    </item>

    <!--===============-->


    <!--ForeGround-->

    <item>
        <rotate
            android:fromDegrees="40"
            android:pivotX="100%"
            android:pivotY="0%"
            android:toDegrees="0">
            <shape android:shape="rectangle">
                <solid android:color="#d4e5ff" />
            </shape>
        </rotate>
    </item>
    <item android:right="10dp">
        <shape android:shape="rectangle">
            <solid android:color="#d4e5ff" />
            <corners android:radius="4dp" />
        </shape>
    </item>

</layer-list>