Detailed Android shape's usage summary _android

Source: Internet
Author: User

Shape is used to set shapes, can be used in selector,layout, and so on, with 6 child tags, each with the following properties:  

 <?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <!--rounded corner--> <corners android:radius= "9DP" android:topleftradius= "2DP" Android:toprightrad  ius= "2DP" android:bottomleftradius= "2DP" android:bottomrightradius= "2DP"/><!--set Fillet radius--> <!--gradient --> <gradient android:startcolor= "@android: Color/white" android:centercolor= "@android: Color/black" an Droid:endcolor= "@android: Color/black" android:uselevel= "true" android:angle= "android:type=" and "radial" roid:centerx= "0" android:centery= "0" android:gradientradius= "/> <!--interval--> <padding and roid:left= "2DP" android:top= "2DP" android:right= "2DP" android:bottom= "2DP"/><!--each direction interval--> < !--size--> <size android:width= "50DP" android:height= "50DP"/><!--width and height--> <!--fill
  ; <solid Android:coloR= "@android: Color/white"/><!--fill Color--> <!--stroke--> <stroke android:width= "2DP" Android:
 Color= "@android: Color/black" android:dashwidth= "1DP" android:dashgap= "2DP"/> </shape>

Fills: Setting the color of a fill

Interval: Sets the interval in four directions

Size: Setting size

Rounded Corner: The Radius property is not valid if five properties are set at the same time

    • android:radius= "20DP" sets the radius of Four Corners
    • android:topleftradius= "20DP" sets the radius of the upper-left corner
    • android:toprightradius= "20DP" sets the radius of the upper right corner
    • android:bottomleftradius= "20DP" sets the radius of the lower right corner
    • android:bottomrightradius= "20DP" sets the radius of the lower-left corner

Strokes: Dashwidth and Dashgap properties, as long as one of them is set to 0DP, the border is the implementation border

    • Android:width= "20DP" sets the width of the edges
    • Android:color= "@android: Color/black" Sets the color of the edges
    • Android:dashwidth= "2DP" sets the width of the dashed line
    • android:dashgap= "20DP" sets the interval width of dashes

Gradient: No gradient effect after setting the fill color. The value of the angle must be a multiple of 45 (including 0), only valid in type= "linear", or it will be an error. Android:uselevel This property does not know what is the use.

Angle the starting point of the corresponding value is shown in figure:

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.