with - Create borders on a android view in drawable xml, on 3 sides?

how to set border in android layout (2)

I want to make a drawable for my Android button, defined as drawable. I found I could set all the borders by using a rectangle, but I got kinda stuck when I wanted it on three sides. I want for example have either the top or the bottom open.

Could anyone show me how to do this?

If anyone is running into issues regarding padding taking effect in the accepted answer, try taking a look at: https://.com/a/11006931. That solution uses position attributes on the tags to achieve the same effect.

I was having trouble using the accepted answer here while creating drawables for use in an ActionBar, and the linked approach worked for me.

Try doing this, though I saw it on some other post

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

<shape android:shape="rectangle" >
    <solid android:color="#FFFFFF" />
        //android:bottom="10dp"  Remove this to avoid seeing the bottom border 
        //android:top="10dp"  Remove this to avoid seeing the top border

    <corners android:radius="5dp" />
<shape android:shape="rectangle" >
        android:top="5dp" />

    <solid android:color="#666666" />