Android Shape Usage Summary

Source: Internet
Author: User
Tags dashed line

/**     * Crazyandcoder     * Contact:     *      QQ   : 275137657     *      Email: [Email protected]     * Reprint please indicate the source!     

Android Shape Usage Summary

Shape means shapes, and shape in Android can define the shape and style of the control. The specific usage is to create a new. xml file under Res/drawable and then set the style of the control. Let's start by looking at the properties that shape contains:

    • Corners
Corners represents a fillet, what does it mean? That is, sometimes we have to set the rounded shape around the control, so we can set this property value. It has five sub-attribute values, which represent the rounded radius of the whole, and the radius of the rounded corners that have been four weeks. However, it is important to note that if the five attribute values are set, then the "Android:radius" property value will not work.



    • Gradient
gradient represents the meaning of the gradient, that is, for its color has a gradient style, we still have to use examples to specify the better.
    1. StartColor: The color at which the gradient starts
    2. EndColor: Color at end of gradient
    3. Angle: The angle of the gradient, the value is a multiple of 45°, 0 is a left-to-right gradient, 90 is the bottom-up gradient, and the counter-clockwise gradient.
    4. Type: Types of gradients, default linear, specifying a gradient radius when selected as radial Gradientradius
       

type= "radial " type= "linear"

    • Solid
a color fill that represents the color that the control is overwritten with. Only one property value: Android:color= "#42fd45"
    • Stroke
What do you mean by strokes? Even if the edge of the control is drawn.

    1. Width: thickness of the control stroke
    2. Color: Colors after a control stroke
    3. Dashwidth: Indicates the width of "-"
    4. Dashgap: Represents the distance between two "-", if set 3, 42 attributes is a dashed line, not set is the solid lines.

3, 4 property not set 3, 4 property
These are the main properties of shape, and by setting these property values, we can draw the effect we want, what good is this? It is not necessary to use the image to fix the style of the control, which will reduce the size of the APK package. If we make good use of it, we can draw the effect we want.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Shape Usage Summary

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.