Today made a button, do not want to trouble art to do pictures, and do not like square corner of the picture, using XML to do a rounded picture, done after the discovery, click on the time to see the effect of the click, XML can define the click Effect,
Just want to how can two achieve together, on-line looked under the general look over is not what I want, slowly tried, the result of both a combination OK.
1 <Button2 Android:id= "@+id/repeat"3 Android:layout_width= "Fill_parent"4 Android:layout_height= "Wrap_content"5 Android:text= "Re-start the answer"6 Android:layout_marginleft= "10dip"7 Android:layout_marginright= "10dip"8 Android:layout_margintop= "25dip"9 Android:background= "@drawable/button_style"Ten />
Button_style as follows:
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <selectorxmlns:android= "Http://schemas.android.com/apk/res/android" >3 <Itemandroid:state_pressed= "true">4 <Shapexmlns:android= "Http://schemas.android.com/apk/res/android"5 Android:shape= "Rectangle">6 <!--deep red button with rounded corners -7 <SolidAndroid:color= "#4D0A0A"/>8 <CornersAndroid:radius= "8dip"/>9 </Shape> Ten </Item> One A <Itemandroid:state_pressed= "false"> - <Shapexmlns:android= "Http://schemas.android.com/apk/res/android" - Android:shape= "Rectangle"> the <!--red button with rounded corners - - <SolidAndroid:color= "#D9534F"/> - <CornersAndroid:radius= "8dip"/> - </Shape> + </Item> - + </selector>
Button_style.xml is an XML file that is defined under drawable.
<android:radius= "8dip"/> defines the fillet size.