shape 学习
目录
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape=["rectangle" | "oval" | "line" | "ring"] >
<corners
android:radius="integer"
android:topLeftRadius="integer"
android:topRightRadius="integer"
android:bottomLeftRadius="integer"
android:bottomRightRadius="integer" />
<gradient
android:angle="integer"
android:centerX="integer"
android:centerY="integer"
android:centerColor="integer"
android:endColor="color"
android:gradientRadius="integer"
android:startColor="color"
android:type=["linear" | "radial" | "sweep"]
android:useLevel=["true" | "false"] />
<padding
android:left="integer"
android:top="integer"
android:right="integer"
android:bottom="integer" />
<size
android:width="integer"
android:height="integer" />
<solid
android:color="color" />
<stroke
android:width="integer"
android:color="color"
android:dashWidth="integer"
android:dashGap="integer" />
</shape>
back to top
shape设置形状
rectangel设置矩形oval设置椭圆line设置线ring设置圆环
back to top
corners是圆角大小,也就是边边设置为圆形的弧度显著程度
包含
radius总体的圆角程度topLeftRadius左上方的圆角程度topRightRadius右上方的圆角程度bottomLeftRadius左下方的圆角程度bottomRightRadius右下方的圆角程度
back to top
gradient设置颜色渐变
centerX,centerY渐变的中心点(圆心)linear线性渐变radial放射渐变,gradientRadius也必须设定sweep扫描性渐变startColor渐变起始的颜色centerColor中心点颜色edgeColor边缘颜色endColor渐变结束的颜色angle渐变的角度
back to top
padding设置内边距
bottom设置顶部内边距
left设置左边内边距
right设置右边内边距
top设置顶部内边距
back to top
size设置大小
width设置宽度大小
height设置高度大小
back to top
solid设置填充颜色
color设置内填充颜色
back to top
stroke设置边框大小以及边框颜色
width设置边框的大小
color设置边框的颜色