Android layout to achieve rounded border effect

First, create a new folder drawable under res and three new XML files: shape_ corner_ down. xml、shape_ corner_ up. XML and shape_ corner. XML, respectively, the lower two corners are rounded borders, the upper two corners are rounded borders, and all the four corners are rounded borders.

shape_ corner_ down. xml:

shape_ corner_ up. xml:

shape_ corner. xml:

< solid Android: color > sets the background color. Android: topleftradius, Android: toprightradius, Android: bottomleftradius and Android: bottomrightradius are the radius values of the upper left corner, upper right corner, lower left corner and lower right corner respectively. If the radius value is set, the corresponding corner is the fillet. The larger the radius value, the larger the fillet< Stroke > set boundary properties, such as the width and color of the boundary.

In activity_ main. Three linearlayouts are placed on the XML, and the Android: background attribute is set to shape respectively_ corner_ up. xml、shape_ corner_ down. XML and shape_ corner. XML, the running results are as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>