Here are 2 ways to change the button shape, one directly by setting a circular background image,
Another way to do this is by referencing a custom shape file. See below for details:
--------Main_menu_btnshape.xml the custom shape XML file
<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Oval"> <!--the color of the fill - <SolidAndroid:color= "#FFFFFF"/> <!--set the Four corners of the button as arcs - <!--Android:radius radius of Arc - <CornersAndroid:radius= "360dip"/> <!--The spacing between the text inside the Padding:button and the Button boundary - <paddingAndroid:left= "10DP"Android:top= "10DP"Android:right= "10DP"Android:bottom= "10DP" /></Shape>
-----Main Layout File
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"android:orientation= "vertical"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent" ><TextViewAndroid:layout_width= "Fill_parent"Android:layout_height= "Wrap_content"Android:text= "@string/soft_info"/> <!-Set background directly--><ButtonAndroid:id= "@+id/roundbtn1"Android:background= "@drawable/btn_oval"Android:layout_width= "50dip"Android:layout_height= "50dip" /> <!-Call shape custom XML file--><ButtonAndroid:id= "@+id/roundbtn"Android:text= "ellipse button"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "@drawable/main_menu_btnshape" /> </LinearLayout>
----acitivity File
Public class extends Activity { /***/ @Override publicvoid onCreate (Bundle savedinstancestate) { super. OnCreate (savedinstancestate); Setcontentview (R.layout.main); }}
Custom button shape (circle, ellipse)