shape 学习

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设置边框的颜色

back to top

posted @ 2020-03-15 09:42  野生的Lemon柠檬  阅读(197)  评论(0编辑  收藏  举报

呱呱呱呱呱🐸