0

How do I code a Downward facing Triangle using XML only in Android?

What I need:

enter image description here

Here's what I tried but I end up with a weird shape:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <rotate
            android:fromDegrees="45"
            android:toDegrees="45"
            android:pivotX="-40%"
            android:pivotY="87%" >
            <shape
                android:shape="rectangle" >
                <stroke android:color="#5F82D2" android:width="10dp"/>
                <solid
                    android:color="#5F82D2" />
            </shape>
        </rotate>
    </item>
</layer-list>
Dinuka Jay
  • 4,583
  • 6
  • 63
  • 132

1 Answers1

0

Try this :

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
    <rotate
        android:fromDegrees="45"
        android:pivotX="230%"
        android:pivotY="27%"
        android:toDegrees="45" >
        <shape android:shape="rectangle" >
            <stroke
                android:width="10dp"
                android:color="#00000000" />

            <solid android:color="#00ACED" />
        </shape>
    </rotate>
</item>
</layer-list>

This is what i got

Akhil Soman
  • 1,917
  • 2
  • 14
  • 28