Own Button shape in Android / using multiple shapes as background



I am working on Android project. I have ListView with custom buttons with rounded shape and white color. What I am trying to add is custom grey shape - rectangle combined with triangle:


enter image description here


Main Button Definition in XML



<Button xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/button_dropdown_category"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:background="@drawable/list_category_button"
android:minHeight="45dp"
android:maxHeight="45dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:paddingLeft="20dp"
android:text="@null"
android:textSize="18sp"
android:gravity="left|center_vertical" />


Shape Button Definition in XML (list_category_button)



<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg">
<item>
<layer-list>
<item>
<shape xmlns:android="http://ift.tt/nIICcg"
android:shape="rectangle"
>
<solid android:color="@color/main_red_color" />
<size android:height="50dp"
android:width="50dp"/>
</shape>
</item>
<item>
<shape>
<solid android:color="@color/main_white_color" />
<stroke
android:width="1dp"
android:color="@color/main_darkgrey_color" />
<corners
android:radius="4dp" />
<padding
android:left="3dp"
android:top="3dp"
android:right="3dp"
android:bottom="3dp" />
</shape>
</item>
</layer-list>
</item>
</selector>

No comments:

Post a Comment