The general button is rectangular or square, but in order to show different effects, so that the interface more beautiful, you can handle it!!!
1. A button with radians in the corners
2. Press button to display different colors
Implementation steps:
First, create an XML file under the Drawable folder, for example, named Shape_button.xml
The Shape_button.xml code is as follows:
<?XML version= "1.0" encoding= "Utf-8"?><selectorxmlns:android= "Http://schemas.android.com/apk/res/android"> <Itemandroid:state_pressed= "true" > <Shape> <SolidAndroid:color= "#fff67f" /> <CornersAndroid:radius= "20DP"/> </Shape> </Item> <Itemandroid:state_enabled= "true" > <Shape> <SolidAndroid:color= "#00cc33" /> <CornersAndroid:radius= "20DP"/> </Shape> </Item></selector>
This file is then referenced in the SRC attribute of the button
<ButtonAndroid:onclick= "PageDown"Android:layout_width= "Match_parent"Android:layout_margintop= "260DP"Android:layout_height= "180DP"Android:background= "@drawable/shape_button"android:textsize= "30SP"Android:textstyle= "Bold"Android:layout_marginbottom= "10DP"Android:text= "Next Page" />
The above is the detailed steps!!!
Button Corners have radians and press to display different colors