Android必备知识点之的Drawable(待补充)

1.shape的基本使用

根据官方给出的API整理的:

<?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"//渐变角度0:左到右;90:下到上;180:右到左;270:上到下
        android:centerX="integer"//表示渐变的X轴起始位置,范围0-1,0.5表示圆心。
        android:centerY="integer"
        android:centerColor="integer"
        android:endColor="color"
        android:gradientRadius="integer"
        android:startColor="color"
        android:type=["linear"//线性渐变 | "radial"//放射渐变 | "sweep"//扫描性渐变]//渐变类型
        android:useLevel=["true" | "false"]//一般为flase/>

    <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>
全部评论

相关推荐

好羡慕走AI技术方向的人,实习薪资这么高😱&nbsp;人比人气死人😭
勇敢的嘟教授在考古:芯片公司挣得多多的,钱给的还不如互联网
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务