Use of Android shape

Source: Internet
Author: User
Tags dashed line

Shape is used for setting shapes, can be used in selector,layout and so on, there are 6 sub-tags, the properties are as follows:

<?XML version= "1.0" encoding= "Utf-8"?><ShapeXmlns:android= "Http://schemas.android.com/apk/res/android"><!--Rounded Corners-<CornersAndroid:radius= "9DP"Android:topleftradius= "2DP"Android:toprightradius= "2DP"Android:bottomleftradius= "2DP"Android:bottomrightradius= "2DP"/><!--Set the fillet radius-<!--Gradient-<GradientAndroid:startcolor= "@android: Color/white"Android:centercolor= "@android: Color/black"Android:endcolor= "@android: Color/black"Android:uselevel= "true"Android:angle= "45"Android:type= "Radial"Android:centerx= "0"Android:centery= "0"Android:gradientradius= "90"/><!--Interval-<PaddingAndroid:left= "2DP"Android:top= "2DP"Android:right= "2DP"Android:bottom= "2DP"/><!--intervals in each direction-<!--Size-<SizeAndroid:width= "50DP"Android:height= "50DP"/><!--Width and height-<!--Fill-<SolidAndroid:color= "@android: Color/white"/>--> <!-- stroke -- > <stroke  Android:width= "2DP"  Android:color= "@android: Color/black"  Android:dashwidth= "1DP" Span style= "color: #ff0000;" > Android:dashgap= "2DP" /> </shape>  

Fill: Sets the color of the fill

interval: sets the interval in four directions

Size: set Size

fillet: set five properties at the same time, the RADIUS attribute is invalid

android:radius= "20DP" sets the radius of Four Corners

android:topleftradius= "20DP" sets the radius of the upper-left corner
Android:toprightradius= "20DP" set the radius of the upper-right corner
android:bottomleftradius= "20DP" setting the radius of the lower right corner
Android:bottomrightradius= "20DP" set the radius of the lower left corner

strokes:dashwidth and Dashgap properties, as long as one is set to 0DP, the border is the implementation border

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

Gradients: when the fill color is set, there is no gradient effect. 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 attribute does not know what is the use.

Angle the starting point of the corresponding value

Transfer from: Link

Use of Android shape (RPM)

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.