Question

I use button with Font Awesome. When I try to set borders only on three sides of button, I see that border is all around my button. Here is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:top="1dip" android:bottom="1dip" android:left="1dip"><shape>
        <solid android:color="#efeae0" />

        <stroke android:width="1dp" android:color="#d5cfc3" />

        <corners android:topLeftRadius="15dp" />
    </shape></item>

</selector>

How can I remove border from right side of button?

Was it helpful?

Solution

i am create button using below tool may useful to you :)

http://angrytools.com/android/button/

see this solution

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 <!-- This is the line -->
 <item android:top="-2dp"  android:left="-2dp" android:bottom="-2dp">
  <shape>
        <solid android:color="@android:color/transparent" />
        <stroke android:width="2dp" android:color="#21610B" />
  </shape>
</item>
</layer-list>

you can change border side and color

OTHER TIPS

Try out the below code to set the border in your view.

<?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="#FF0000" />
    <padding
        //android:bottom="10dp"  Remove this to avoid seeing the bottom border 
        android:left="10dp"
        android:right="10dp"
        //android:top="10dp"  Remove this to avoid seeing the top border
    />

    <corners android:radius="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
    <padding
        android:bottom="5dp"
        android:left="5dp"
        android:right="5dp"
        android:top="5dp" />

    <solid android:color="#666666" />
</shape>
</item>
</layer-list>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top