Make a circular button with a frame

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

I have attached a screenshot of one of my iOS apps that shows what I want.

enter image description here

+7
android android-button
source share
2 answers

For your button use

<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 color values ​​and the text you want. Enjoy it!

+18
source share

You need to create a pattern for the oval. Like this

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="@android:color/transparent"/> <stroke android:color="#fff" android:width="3px"/> </shape> 

And then in your xml layout set the background for this flexible

 android:background="@drawable/your_drawable" 
+5
source share

All Articles