Android plotting-shape usage

Source: Internet
Author: User

Transfer http://wang-peng1.iteye.com/blog/523869

In gradientdrawable1's attempt, I finally learned the shape. I used to understand it clearly. Now I finally figured out what was in it. I also admired Google's intentions and deliberately set some traps, if you don't take it seriously, I think it will be ineffective.
Setcontentview (R. layout. shape_drawable_1)
The Code of shape_drawable_1 is as follows:
<Scrollview xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content">

<Linearlayout
Android: Orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content">

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"
Android: src = "@ drawable/shape_1"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"
Android: src = "@ drawable/line"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"
Android: src = "@ drawable/shape_2"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: src = "@ drawable/line"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"
Android: src = "@ drawable/shape_3"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "20dip"
Android: src = "@ drawable/line"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"
Android: src = "@ drawable/shape_4"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: src = "@ drawable/line"/>

<Imageview
Android: layout_width = "fill_parent"
Android: layout_height = "50dip"

Android: src = "@ drawable/shape_5"/>

</Linearlayout>
</Scrollview>
Code of shape_5:
<Shape xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Shape = "rectangle">
<Gradient Android: startcolor = "# ffff0000" Android: endcolor = "# 80ff00ff"
Android: angle = "270" type = "parmname" text = "parmname"/>
<Padding Android: Left = "50dp" Android: Top = "20dp"
Android: Right = "7dp" Android: Bottom = "7dp"/>
<Corners Android: radius = "8dp"/>

</Shape>
Gradient generates a color gradient Android: from which angle it seems to be changed to only an integer multiple of 90.
Android: Shape = "rectangle" is also a rectangle by default.

<Shape xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Shape = "Oval">
<Solid Android: color = "# ff4100ff"/>
<Stroke Android: width = "2dp" Android: color = "# ee31ff5e"
Android: dashwidth = "3dp" Android: dashgap = "2dp"/>
<Padding Android: Left = "7dp" Android: Top = "7dp"
Android: Right = "7dp" Android: Bottom = "7dp"/>
<Corners Android: radius = "6dp"/>
</Shape>

# Ff4100ff blue # ff4100ff green
<Solid Android: color = "# ff4100ff"/> solid filling
<Stroke draws the contour line in that way

Android: dashwidth = "3dp" Android: dashgap = "2dp" Default Value: 0

Android: width = "2dp" Android: color = "# ff00ff00" pen width,
Android: dashwidth = "5dp" Android: dashgap = "5dp" implementation---This effect, dashwidth refers to the width of a small horizontal line
Dashgap refers to the gap between a small horizontal line and a small horizontal line. Width = "2dp" cannot be too wide

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.