0

I'm trying to achieve the below image through Android xml

enter image description here

Right now I could just achieve this with help of some SOF q&a

enter image description here

Below are the code to achieve the above result

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

<item>
    <rotate
        android:fromDegrees="45"
        android:toDegrees="45"
        android:pivotX="87%"
        android:pivotY="140%">
        <shape android:shape="rectangle">
            <solid android:color="@color/lime_green_32CD32"/>
        </shape>
    </rotate>
</item>
a_local_nobody
  • 6,231
  • 5
  • 18
  • 42
Ssubrat Rrudra
  • 719
  • 6
  • 17
  • 1
    You might find [this post](https://stackoverflow.com/q/26143905/3290339) helpful. There is a brief explanation on how it's done [here](https://stackoverflow.com/a/26320942/3290339). – Onik Feb 19 '21 at 14:00

1 Answers1

1

Using below code, you can get something close to enter image description here

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
            <item
                android:width="35dp"
                android:height="35dp"
                android:top="7dp">
                <rotate
                    android:fromDegrees="45"
                    android:pivotX="87%"
                    android:pivotY="140%"
                    android:toDegrees="45">
                    <shape android:shape="rectangle">
                        <solid android:color="@color/white" />
                    </shape>
                </rotate>
            </item>
            <item
                android:width="150dp"
                android:height="50dp"
                android:left="44.5dp">
                <shape android:shape="rectangle">
                    <solid android:color="@color/white" />
                </shape>
            </item>
            <item
                android:width="10dp"
                android:height="10dp"
                android:left="35dp"
                android:top="20dp">
                <shape android:shape="oval">
                    <solid android:color="@color/white" />
                </shape>
            </item>
        </layer-list>
    </item>
    <item android:top="2dp" android:bottom="2dp" android:right="2dp" android:left="2dp">
        <layer-list>
            <item
                android:width="33dp"
                android:height="33dp"
                android:left="2dp"
                android:top="6dp">
                <rotate
                    android:fromDegrees="45"
                    android:pivotX="87%"
                    android:pivotY="140%"
                    android:toDegrees="45">
                    <shape android:shape="rectangle">
                        <solid android:color="@color/green" />
                    </shape>
                </rotate>
            </item>
            <item
                android:width="145dp"
                android:height="46dp"
                android:left="44.5dp">
                <shape android:shape="rectangle">
                    <solid android:color="@color/green" />
                </shape>
            </item>
            <item
                android:width="10dp"
                android:height="10dp"
                android:left="35dp"
                android:top="20dp">
                <shape android:shape="oval">
                    <solid android:color="@color/white" />
                </shape>
            </item>
        </layer-list>
    </item>
</layer-list>
rajan.kali
  • 10,789
  • 3
  • 22
  • 33