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