2

Is it possible to make such design with xml using shape if yes how can I do it and what is more efficiant for loading and memory image as png or drawable with a lot of shapes? enter image description here

Community
  • 1
  • 1
LeTadas
  • 3,436
  • 9
  • 33
  • 65

2 Answers2

2

You 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="270%"
            android:pivotY="70%"
            android:toDegrees="45">
            <shape android:shape="rectangle">
                <stroke
                    android:width="1dp"
                    android:color="@android:color/transparent" />
                <solid android:color="#ffffff" />
            </shape>
        </rotate>
    </item>
</layer-list>

Edit: rotate shape

enter image description here

akhilesh0707
  • 6,709
  • 5
  • 44
  • 51
1

you can tileMode = repeat and for shape use this drawable vector and check this link

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <rotate
            android:fromDegrees="45"
            android:pivotX="-40%"
            android:pivotY="50%"
            android:toDegrees="90">
            <shape android:shape="rectangle">
                <stroke
                    android:width="-140dp"
                    android:color="@android:color/transparent" />
                <solid android:color="@android:color/background_dark" />
            </shape>
        </rotate>
    </item>
</layer-list>

enter image description here

Rasoul Miri
  • 11,234
  • 1
  • 68
  • 78