From: http://www.cnblogs.com/cyanfei/archive/2012/07/27/2612023.html
Shape is used to set the shape. It can be used in selector, layout, and so on. There are 6 sub-labels. Each attribute is as follows:
<? 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: toprightradius = "2dp" Android: bottomleftradius = "2dp" Android: bottomrightradius = "2dp" /> <! -- Set the rounded corner radius --> <! -- Gradient --> < Gradient Android: 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 --> < Padding Android: left = "2dp" Android: Top = "2dp" Android: Right = "2dp" Android: Bottom = "2dp" /> <! -- Interval in each direction --> <! -- 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 >
Fill:Set fill color
Interval:Set the interval in four directions
Size:SET SIZE
Rounded corner:If five attributes are set at the same time, the radius attribute is invalid.
Android: radius = "20dp" sets the radius of the four corners
Android: topleftradius = "20dp" sets the radius in the upper left corner.
Android: toprightradius = "20dp" sets the radius in the upper right corner.
Android: bottomleftradius = "20dp" sets the radius in the lower right corner.
Android: bottomrightradius = "20dp" sets the radius in the lower left corner.
Stroke:The dashwidth and dashgap attributes. If one of them is set to 0dp, the border is the implemented border.
Android: width =" 20dp "sets the edge width
Android: color =" @ Android: color/Black "set the edge color
Android: dashwidth =" 2dp "set the width of the dotted line
Android: dashgap = "20dp" set the interval width of the dotted line
Gradient:After the fill color is set, there is no gradient effect. The angle value must be a multiple of 45 (including 0) and only valid in type = "linear". Otherwise, an error is returned. Android: uselevel.
Start Point of the angle value