Android Triangle Drawablw Xml
I want to draw an equilateral triangle.I have checked but it is inverted.I want a triangle that looks like the image below. Triangle: triangle_shape.xml:
Solution 1:
Usign Vector drawable you can achieved your shape like below:
<?xml version="1.0" encoding="utf-8"?><vectorxmlns:android="http://schemas.android.com/apk/res/android"android:width="100dp"android:height="100dp"android:viewportHeight="100"android:viewportWidth="100"><groupandroid:name="triableGroup"><pathandroid:name="triangle"android:fillColor="@color/color_start_color_back"android:pathData="m 50,0 l 50,50 -100,0 z" /></group></vector>
Output:
I hope its helps you.
Solution 2:
Try this way it will work
<?xml version="1.0" encoding="utf-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android" ><item><rotateandroid:fromDegrees="45"android:pivotX="-40%"android:pivotY="87%"android:toDegrees="45" ><shapeandroid:shape="rectangle" ><strokeandroid:width="10dp"android:color="#00000000" /><solidandroid:color="#00ACED" /></shape></rotate></item></layer-list>
OUTPUT
Solution 3:
I have found out the way to make it look like an up facing triangle.
<layer-listxmlns:android="http://schemas.android.com/apk/res/android" ><item><rotateandroid:fromDegrees="-45"android:toDegrees="45"android:pivotX="270%"android:pivotY="70%" ><shapeandroid:shape="rectangle" ><strokeandroid:color="#000000"android:width="1dp"/><solidandroid:color="#000000" /></shape></rotate></item></layer-list>
Post a Comment for "Android Triangle Drawablw Xml"