Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

easy arrow as drawable

I have spent hours trying to make the below arrow using drawables using all kind of rotations without any success it simply never looked like it:

The insanely difficult arrow

Is it even possible to make it using shape/layer-list, without using png?

* EDIT *

The closest I could get to the desired arrow was this. I could never put the lines to match and NOT to overlap:

My best try

like image 951
Amio.io Avatar asked Feb 11 '23 05:02

Amio.io


1 Answers

maybe this what you are looking for

arrow.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="100%"
            android:pivotY="50%"
            android:toDegrees="-45">
            <shape
                android:shape="line">
                <stroke
                    android:width="3dp"
                    android:color="@android:color/holo_green_light"
                    />
            </shape>
        </rotate>
    </item>

    <item>
        <rotate
            android:fromDegrees="45"
            android:pivotX="100%"
            android:pivotY="50%"
            android:toDegrees="45">
            <shape
                android:shape="line">
                <stroke
                    android:width="3dp"
                    android:color="@android:color/holo_green_light"
                    />
            </shape>
        </rotate>
    </item>
</layer-list>

in case you have edges not sticking you can add top and bottom to elements so for first one add <item android:bottom="5dp"> for second <item android:top="4dp"> ....

like image 179
Vilen Avatar answered Feb 15 '23 09:02

Vilen