How does Android set the rounded corner button and android rounded corner button?

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.