加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

shape 图形

发布时间:2020-12-16 23:37:30 所属栏目:百科 来源:网络整理
导读:主要属性: ?xml version="1.0"encoding="utf-8"? shape corners / gradient / padding / size / solid / stroke / /shape 1、corners属性(圆角): corners android:radius="10dp" android:topLeftRadius="10dp" android:topRightRadius="20dp" android:bo

主要属性:

<?xml version="1.0"encoding="utf-8"?>
<shape >
<corners />
<gradient />
<padding />
<size />
<solid />
<stroke />
</shape>

1、corners属性(圆角):

<corners
android:radius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="20dp"
android:bottomRightRadius="30dp"
android:bottomLeftRadius="40dp"/>

2、gradient属性(渐变色):

<gradient
android:type="radial"
android:angle="0"
android:startColor="@color/red"
android:centerColor="@color/green"
android:endColor="@color/white"
android:centerX="0.3"
android:centerY="0.5"
android:useLevel="false"
android:gradientRadius="200dp"/>

type:取值["linear" | "radial" | "sweep"]共有3中渐变类型,分别是线性渐变(默认)、放射渐变、扫描式渐变。

angle:仅对线性渐变有效,0为从左到右(逆时针旋转),必须为45的倍数,90为从下到上。

3、padding属性:

<padding

android:bottom="2dp"

android:left="3dp"?

android:right="3dp"?

android:top="2dp"/>

4、size属性:

<size

android:width="180dp"

android:height="100dp"/>

5、solid属性:

?<solid android:color="#ff5900"/>

6、stroke属性(描边):

<stroke

android:width="5dp"?

android:color="@color/red"

android:dashWidth="100dp"

android:dashGap="50dp"/>

7、shape属性:

<?xml version="1.0"encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:dither="false" android:tint="@color/red" android:tintMode="src_atop" android:visible="true" android:innerRadius="100dp" android:innerRadiusRatio="20" android:thickness="100dp" android:thicknessRatio="6" android:useLevel="false"></shape>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读