Original link http://blog.csdn.net/psmmsp/article/details/51353172
The properties of shape are:
- corners– Fillet
- padding– inner margin
- Size (height, width) – Set width height
- stroke– Strokes
- gradient– Gradient
- solid– Fill
Introduced separately
1.corners– rounded Corners
<corners android:radius="10dp" android:bottomLeftRadius="10dp" android:bottomRightRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" ></corners>
Setting radius= "10DP" is equivalent to: set the left and right to 10DP respectively, vice versa
2.padding– Inner margin
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp"/>
This is a good understanding, no explanation.
3.size (height, width) – Set width height
<size android:height="10dp" /><size android:width="100dp"/>
4.stroke– Strokes
<stroke android:color="@color/red_200" android:width="2dp" android:dashWidth="1dp" android:dashGap="1dp" ></stroke>
Width: The breadth of the stroke; color: The dark color of the stroke; Dashgap: The default 0DP is solid, not 0 dashed, and the value represents the distance between virtual points; Dashwidth: Controls the width of the virtual point when it is a dashed line
5.gradient– Gradient
<gradient android:centerColor="#ff00ff00" android:endColor="#ff0000ff" android:startColor="#ffff0000" android:gradientRadius="100dp" android:type="radial" />
StartColor set start color, EndColor end color, centercolor middle color
When type is radial expressed as a gradient centered around the Gradientradius radius,
When type is linear, Gradientradius is invalid and the result is:
6.solid– Fill
<solid android:color="@android:color/white"></solid>
OK, welcome advice.
Personal GitHub
Using shape in Android