vivianaranha
vivianaranha

Reputation: 2781

Android Drawable Shape with 3 layer border

enter image description hereenter image description here

Hi I am trying to add a border to a view which has yellow border but it also has a black border on both sides of primary border.

Any ideas

Upvotes: 0

Views: 403

Answers (1)

Gulshan Yadav
Gulshan Yadav

Reputation: 451

Try this drawable layout for border on top and bottom

<?xml version="1.0" encoding="utf-8"?>
<layer-list 
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <stroke
            android:width="2dp"
            android:color="#ffff00" />
        <solid android:color="#000000" />
    </shape>
</item>

<item
    android:bottom="2dp"
    android:top="2dp">
    <shape android:shape="rectangle">
        <stroke
            android:width="2dp"
            android:color="#000000" />
    </shape>
</item>

</layer-list>

Try this for left and right border

<?xml version="1.0" encoding="utf-8"?>

<layer-list 
xmlns:android="http://schemas.android.com/apk/res/android">

<item>
    <shape android:shape="rectangle">
        <solid android:color="#ffff00"/>
    </shape>
</item>

<item android:left="4dp">
    <shape android:shape="rectangle">
        <solid android:color="#000000"/>
    </shape>
</item>


<item android:right="4dp">
    <shape android:shape="rectangle">
        <solid android:color="#000000"/>
    </shape>
</item>

</layer-list>

Upvotes: 1

Related Questions