skm
skm

Reputation: 609

How to make top and sides of shape white?

I have the following rectangle in black with round corners and want to add the top, left and right border only white.

when I use stroke, the all sides get border, but I don´t want the button one to have one.

enter image description here

Here is my current shape:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000" />
<corners android:radius="1dp" android:topLeftRadius="6dp" android:topRightRadius="6dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp"
    android:color="#fffffff"/>

Upvotes: 1

Views: 377

Answers (1)

Kishore Jethava
Kishore Jethava

Reputation: 6834

Here is perfect solution !!

<?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="@android:color/black" />
        <padding android:bottom="-10dp"/>
        <padding android:top="10dp"/>
        <padding android:right="10dp"/>
        <padding android:left="10dp"/>
        <corners android:topLeftRadius="10dp" android:topRightRadius="10dp"
            android:bottomLeftRadius="0.1dp" android:bottomRightRadius="0.1dp"/>
    </shape>
</item>

<item>
    <shape
        android:shape="rectangle">
        <stroke android:width="1dp" android:color="@android:color/white" />
        <padding android:bottom="1dp"/>
        <corners android:radius="10dp" />
    </shape>
</item>
</layer-list>

Upvotes: 1

Related Questions