How does Android set the rounded corner button and android rounded corner button?
1. Create a shape. xml file in the drawable directory under the res directory.
<? 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 = "# FF065E8D"/> <! -- Set the four corners of the button to an arc --> <! -- Android: radius arc radius --> <corners android: radius = "15dip"/> <! -- Padding: The interval between the text in the Button and the Button boundary --> <padding android: bottom = "10dp" android: left = "10dp" android: right = "10dp" android: top = "10dp"/> </shape>
2. Call it in the layout file.
<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: orientation = "vertical"> <Button android: id = "@ + id/roundButton" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: background = "@ drawable/shape" android: text = "Corner button"/> </LinearLayout>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.