button circle android code example

Example 1: android studio make button round

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle">
    <solid android:color="#eeffffff" />
    <corners android:bottomRightRadius="8dp"
        android:bottomLeftRadius="8dp"  
        android:topRightRadius="8dp"
        android:topLeftRadius="8dp"/>
</shape>

Example 2: circle button android

XAML Code

<ImageButton Source="images/button1.png"	//This button is through an image
             Padding="10,10,10,10"
             WidthRequest="45"
             HeightRequest="45"								
             BackgroundColor="#FFFFFF" 		//You can use opacity too for example: #FDFFFFFF
             CornerRadius="108"				//To curve the button							
             x:Name="button1"
             Clicked="button1_Clicked">
</ImageButton>

Tags:

Java Example