The drawable-mdpi in the Res directory establishes the XML file Shape.xml, as shown in:
650) this.width=650; "Src=" http://images.cnitblog.com/blog/299408/201305/ 17101858-701c8eea74a5403b823a88700e7a88b7.jpg "/>
Shape.xml
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
<?xml version= "1.0" encoding= "UTF-8"? > <shape xmlns:android= "Http://schemas.android.com/apk/res/android" android:shape= "Rectangle" > <!-- Fill Color --> <solid android:color= "#FFFFFF" /> <!-- Set Four corners of the button for arcs --> <!-- android:radius arc radius --> <corners android:radius= "5dip" /> <!--The spacing between the text inside the padding:button and the button boundary --> <padding android:left= "10DP" android:top= "10DP" android:right= "10DP" android:bottom= "10DP" &NBSP;/>&NBSP;</SHAPE>
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
Main.xml
Shape.xml resources were used in android:background= "@drawable/shape"
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
<?xml version= "1.0" encoding= "Utf-8"? > <linearlayout xmlns:android= "http// Schemas.android.com/apk/res/android " android:orientation=" vertical " android:layout_width= "Fill_parent" android:layout_height= "Fill_ Parent " > <TextView Android:layout_width= "Fill_parent" android:layout_height= "Wrap_ Content " android:text=" @string/hello " / > <button android:id= "@+id/roundButton" android:text= " Fillet button " android:layout_width= " Wrap_content " android:layout_height=" Wrap_content " android:background= "@drawable/shape" /> </LinearLayout>
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
Strings.xml
<?xml version= "1.0" encoding= "Utf-8"?> <resources> <string name= "Hello" >hello World, Roundbuttondem oactivity!</string> <string name= "App_name" >RoundButtonDemo</string> </resources>
Roundbuttondemoactivity.java
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
package com.android.roundbuttondemo.activity; import android.app.activity; import android.os.Bundle; import android.view.View; import android.view.view.onclicklistener; import android.widget.button; import android.widget.toast; public class roundbuttondemoactivity extends activity { button roundbutton; @Override public void oncreate (bundle savedinstancestate) { super.oncreate (savedInstanceState); setcontentview (R.layout.main); roundbutton= ( Button) Findviewbyid (R.id.roundbutton); //Registering button events with anonymous classes roundbutton.setonclicklistener (New onclicklistener () { public void onclick (VIEW&NBSP;V) { toast.maketext (roundbuttondemoactivity.this, "You clicked on the Fillet button", Toast.LENGTH_ LONG). Show (); } }); } }
650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>
:
650) this.width=650; "Src=" http://images.cnitblog.com/blog/299408/201305/ 17102112-0ee2b7d5e5154f36bd99b0fe01635fe1.jpg "/>
This article is from "Little book" blog, please make sure to keep this source http://8988940.blog.51cto.com/8978940/1577508
Android Development Learning Note: Rounded button