0

How do I create a drawable like this?

shape

Jhii
  • 117
  • 3
  • 14
  • Look at [Shape Drawables](https://developer.android.com/guide/topics/resources/drawable-resource.html#Shape) – ashkhn Jan 06 '17 at 02:11

2 Answers2

1

The search keyword is: "Android how to create custom shapes".

You will find many examples. For example this one.

If you image that shape what you want is a regular rectangle + a triangle you get the result from the link provided, just have to adapt the parameters.

altered image

I hope is helpfully!

Community
  • 1
  • 1
matheszabi
  • 594
  • 5
  • 16
0

Instead of slating the right side, I have slanted the left side, however you can use this logic

***

<!-- Colored rectangle-->
<item>
    <shape android:shape="rectangle">
        <padding android:top="35dp"/>
        <size android:width="200dp"
            android:height="40dp" />
        <solid android:color="#13a89e" />
    </shape>
</item>

<!-- This rectangle for the left side -->
<item
    android:right="200dp"
    android:left="-200dp"
    android:top="-200dp"
    android:bottom="-200dp">
    <rotate android:fromDegrees="-45">
        <shape android:shape="rectangle">
            <padding android:top="-35dp"/>
            <solid android:color="#ffffff" />
        </shape>
    </rotate>
</item>

*** Hope this one helps