Use a layer list drawable, something like this 🙂
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="4dp"
android:top="4dp">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<stroke
android:width="1dp"
android:color="@color/gray" />
<solid android:color="@color/transparent" />
</shape>
solved How can I create such borders of the button? [duplicate]