'drawing a triangle using Vector path and XML in android

I have found how to draw a triangle, but I need to rotate it now and I can't seem to make it..

My goal is to reach this:

enter image description here

So far I have found this code:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="40dp"
    android:height="40dp"
    android:viewportHeight="100"
    android:viewportWidth="100">
    <group android:name="triableGroup">
        <path
            android:name="triangle"
            android:fillColor="@color/some_color"
            android:pathData="m 50,0 l 50,50 -100,0 z" />
    </group>
</vector>

but it appears like this :

enter image description here



Solution 1:[1]

I know this question has already been answered, But follow this way to make your own custom vector drawable.

To make your own custom vector drawable convert your image to svg or psd format and upload your image to android studio as below.

Step 1: Right click on drawable folder, go to new and then select vector asset like this.

enter image description here

Step 2: Now check the Local File (SVG, PSD) radio button and upload your SVG or PSD file. enter image description here enter image description here

What else! Finally you will get your vector drawable file. Happy Coding!!

Solution 2:[2]

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="40dp"
    android:height="40dp"
    android:viewportHeight="100"
    android:viewportWidth="100">
    <group android:name="triableGroup">
        <path
            android:name="triangle"
            android:fillColor="@color/some_color"
            android:pathData="M 0,0 L50,0 50,50 z" />
    </group>
</vector>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DEEPSHIKHA YADAV
Solution 2 Cabezas