Make Circular Button with Border

raginggoat picture raginggoat · Aug 27, 2014 · Viewed 17.6k times · Source

I am trying to make a circular button with a transparent background and a colored border. How can I do this?

I've attached a screenshot of one of my iOS apps that shows what I'm wanting.

enter image description here

Answer

goonerDroid picture goonerDroid · Aug 27, 2014

For your button use this

<Button
 android:id="@+id/yourbuttonname"
 android:text="Button"
 android:textColor="#FFFFFF"
 android:textSize="30sp"
 android:layout_width="100dp"
 android:layout_height="100dp"
 android:background="@drawable/buttonshape"
/>

And create a buttonshape.xml file like this

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle" >
<corners
android:topLeftRadius="100dp"
android:topRightRadius="100dp"
android:bottomLeftRadius="100dp"
android:bottomRightRadius="100dp"
/>
<solid
android:color="#"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>

Just adjust the values of colors and the text you want.Enjoy!!