In XML I'm attempting to draw a drop down triangle to be used as a background for a button but cant seem to get my head round the rotate XML tags.
Here's my XML code:
<?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="80%"
android:pivotY="20%">
<shape
android:shape="rectangle" >
<solid
android:color="#FFCC00" />
</shape>
</rotate>
</item>
</layer-list>
And here's the outcome of the XML:
Any ideas are appreciated.
i can draw triangle shape using XML
triangle .xml
<?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="-40%"
android:pivotY="87%"
android:toDegrees="45" >
<shape android:shape="rectangle" >
<stroke
android:width="10dp"
android:color="#00000000" />
<solid android:color="#00ACED" />
</shape>
</rotate>
</item>
</layer-list>
Try out the Below
<?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="90%"
android:pivotY="-50%" >
<shape
android:shape="rectangle" >
<stroke android:color="@android:color/transparent" android:width="1dp"/>
<solid
android:color="#ffffff" />
</shape>
</rotate>
</item>
</layer-list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With