Android Shape Summary

Source: Internet
Author: User
Tags dashed line

There are 6 basic labels for shape: corners, gradient, solid, stroke, padding, size

    1. Shape can have four shapes: rectangle (Rectangle, default shape), oval (oval), ring (horizontal line), Ring (ring)

    2. About Corners Tags:
      The corners element is only available for rectangle!
      There are a total of 5 properties, a total fillet radius, or Four Corners set the fillet radius, if there is a conflict, the angle is set separately, regardless of the writing order.

    3. about solid/gradient Tags: all two elements represent a fill color, resulting in a conflict. The principle of conflict processing is, select one, according to the order of definition in XML, who defines in the following, who chooses, discards the
      solid has only a color attribute, That is, solid can only fill a single solid color.
      about gradient


      type has 3 kinds of values, linear (linear transformation, default), radial (radial, that is, like a water wave), sweep


    4. About the stroke label represents a stroke. A total of 4 properties: color, Width, dashwidth, dashgap
      Width indicates the thickness of the stroke, and the center of the edge is spread to both sides, whichever is the actual length and width of the shape.
      Dashwidth, Dashgap indicates that a dashed line is drawn as a stroke, and the two properties must appear in pairs, one for each of the length of the dashed line and the interval for each of the two dashes.

    5. About the size label is only used to define a length width, only width and height two properties

    6. When the shape type is ring
      Note that there seems to be a problem with the ring in real time on Android studio
      In general, the Uselevel must be set to false, otherwise the ring cannot be displayed.
      At this point, more than 4 unique attributes (written directly on the root element) are compared to other shapes: Innerradius (Radio), thickness (Radio)
      When the stroke is set, the inner and outer sides will have strokes, and when the solid/gradient is set, only the ring is filled, and the inner circle is always empty.

    7. Shape corresponds to the Android.graphics.drawable.GradientDrawable class

Android Shape Summary

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.