Android layout for rounded borders

Source: Internet
Author: User

First, create a new folder under Res drawable, create a new three XML file under drawable: Shape_corner_down.xml, Shape_corner_up.xml, and Shape_ Corner.xml, respectively, the following two corners are rounded borders, the top two corners are rounded borders, and four corners are rounded borders.

Shape_corner_down.xml:

1234567 <?xml version="1.0"encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">    <solid android:color="#0099CC" />    <corners android:bottomRightRadius="20dp"        android:bottomLeftRadius="20dp"/>    <stroke android:width="1dp"android:color="#000000"/></shape>

Shape_corner_up.xml:

1234567 <?xml version="1.0"encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">    <solid android:color="#CCCC99"/>       <corners android:topLeftRadius="20dp"        android:topRightRadius="20dp"/>    <stroke android:width="1dp"android:color="#000000"/></shape>

Shape_corner.xml:

123456789 <?xml version="1.0"encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">    <solid android:color="#99CCFF"/>       <corners android:topLeftRadius="20dp"        android:topRightRadius="20dp"        android:bottomRightRadius="20dp"        android:bottomLeftRadius="20dp"/>    <stroke android:width="1dp" android:color="#000000"/></shape>

<solid android:color> Sets the background color. Android:topleftradius, Android:toprightradius, Android:bottomleftradius, Android:bottomrightradius are the upper left corner, the upper right corner, the lower left corner, The radius value of the lower right corner, set the RADIUS value, the corresponding corner is rounded, the larger the radius value, the larger the fillet. <stroke> set boundary properties, such as the width, color, etc. of the boundary.

Place three linearlayout on Activity_main.xml, set android:background properties to Shape_corner_up.xml, Shape_corner_down.xml, and Shape_, respectively Corner.xml, the results of the operation are as follows:

Http://www.cnblogs.com/mstk/p/3539587.html

Android layout for rounded borders

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.