Android shape custom shape, set fade color

Source: Internet
Author: User
Tags dashed line


<?XML version= "1.0" encoding= "Utf-8"?><!--android:shape=["Rectangle" | "Oval" | "Line" | The shape of the ring shape, which defaults to a rectangle, can be set to a rectangle (rectangle), oval (oval), linear shape (line), ring, and the following properties are available only at android:shape= "Ring: Android: Innerradius size, radius of inner ring. Android:innerradiusratio float, which represents the radius of the inner ring at the width ratio of the ring, for example, if android:innerradiusratio, which means that the inner ring radius is equal to the width of the ring divided by 5, the value can be overwritten, and the default is 9. Android:thickness size, the thickness of the ring android:thicknessratio float, the width ratio of the ring to represent the thickness of the ring, for example, if android:thicknessratio= "2", then the thickness of the ring is equal to the ring The width is divided by 2. This value can be overridden by android:thickness, and the default value is 3. The Android:uselevel Boolean value, or False if it is used as a levellistdrawable using the value of true. -<Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Rectangle"> <!--fillet android:radius integer radius android:topleftradius integer upper-left corner radius Android:toprightradius Integer right corner radius android:bottomleftradius integer lower-left corner radius Android:bottomrightradius integer right corner radius when you set 5 properties at the same time, Android:radius is not valid - <CornersAndroid:radius= "9DP"Android:topleftradius= "2DP"Android:toprightradius= "2DP"Android:bottomleftradius= "2DP"Android:bottomrightradius= "2DP"/><!--set the fillet radius - <!-- Gradient Android:startcolor color value start color Android:endcolor color value end color Android:centercolor integral gradient middle color , which is the color between the start color and the ending color android:angle integral gradient angle (PS: When angle=0, the gradient is left to right. Then turn counterclockwise, when angle=90 is from bottom to top. Angle must be an integer multiple of 45) Android:type ["Linear" | "Radial" | "Sweep"] Gradient type (value: Linear, radial, sweep) linear linear gradient, which is the default setting radial radioactive gradient Change, centered on the start color. Sweep the gradient of the scanned line type. Android:uselevel ["True" | FALSE] set to TRUE if you want to use the Levellistdrawable object. Set to True no gradient. False has a gradient Android:gradientradius integral gradient radius. Used when android:type= "radial". Using android:type= "Radial" alone will cause an error. Android:centerx the relative position of the X-point coordinate of the integral gradient center android:centery the relative position of the Y-point coordinate of the integral gradient center Android:startcolor,android:centercolor , Android:endcolor: The starting color of the color, the middle color, and the ending color, respectively. If you do not set an intermediate color, you will fade from the starting color to the end color, or you can change from the starting color to the middle color, then the middle color to the end color. Android:centerx,android:centery: I think the premise of the necessity of these two attributes is to have android:centercolor. The reason is that when I do not set the Android:centercolor property, arbitrary changesThe values of both properties do not change the display of the control. These two properties are the middle position of the gradient. The size is 0.0--1.0 again. - <GradientAndroid:startcolor= "@android: Color/white"Android:centercolor= "@android: Color/black"Android:endcolor= "@android: Color/black"Android:uselevel= "true"Android:angle= "$"Android:type= "Radial"Android:centerx= "0"Android:centery= "0"Android:gradientradius= "All"/> <!--Padding , that is, the distance between the content and the edge Android:left integral left inner margin android:top integer on the inner margin Android:right Integral right inner margin android:bottom integral type bottom inner margin - <paddingAndroid:left= "2DP"Android:top= "2DP"Android:right= "2DP"Android:bottom= "2DP"/><!--intervals in each direction - <!--size android:width integer width android:height integer height - <sizeAndroid:width= "50DP"Android:height= "50DP"/><!--Width and Height - <!--Inner Fill Android:color color value fill Color - <SolidAndroid:color= "@android: Color/white"/><!--the color of the fill - <!--Stroke android:width Integer stroke width android:color color value stroke Color Android:dashwidth integer indicates that the style of the stroke is the width of the dashed line, A value of 0 o'clock is expressed as a solid line. A value greater than 0 is a dashed line. Android:dashgap An integer indicates that a stroke is a dashed line, the interval between dashes is "----" android:dashwidth: The length of the line. When this value is set, a dotted line is displayed. Unless you dashwidth set a large value, it looks like a complete line. Android:dashgap: The distance between lines. It only works if the Dashwidth property is set. Can be thought of as the width between dashes. - <StrokeAndroid:width= "2DP"Android:color= "@android: Color/black"Android:dashwidth= "1DP"Android:dashgap= "2DP"/> </Shape>

Android shape custom shape, set fade color

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.