Create Round Oval shape button in android xml

Circle shape buttons on android with choice color fill.

Round shape buttons are used to make poke buttons, bidding buttons, gaming console touch screen buttons because this type of buttons can easily represented by tapping and user can recognize it by seeing it. So here is the complete step by step tutorial for Create Round Oval shape button in android xml.

android-project-download-code-button

How to Create Round Oval shape button in android xml .

Code for MainActivity.java file.

package com.android_examples.com.buttonround;
import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

Code for activity_main.xml layout file.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.android_examples.com.buttonround.MainActivity" >

 <Button
 android:id="@+id/button1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerHorizontal="true"
 android:layout_centerVertical="true"
 android:text="Button"
 android:background="@layout/round_shape"
 android:textColor="#f8fdf9" />

</RelativeLayout>

Code for round_shape.xml layout file.

 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 <item>
 <shape android:shape="oval">
 <size android:width="100dp"
 android:height="100dp"/>
 <solid android:color="#59d5fe"/>
 </shape>
 </item>
</selector>

Screenshot:

Create Round Oval shape button in android xml

Click Here To Download Create Round Oval shape button in android xml project.

2 Comments

  1. thank you for your answer .. thank you thank you thank you

Leave a Reply

Your email address will not be published. Required fields are marked *