android shape设置渐变、圆角、边框线

1、渐变实体背景+圆角:

应用场景:按钮

这里写图片描述

<shape>
            <gradient
                android:endColor="@color/theme_24A7F2"
                android:startColor="@color/theme_1AC6FF"
                android:type="linear" />

            <corners
                android:bottomLeftRadius="100dp"
                android:bottomRightRadius="100dp"
                android:topLeftRadius="100dp"
                android:topRightRadius="100dp" />
        </shape>

2、不带渐变的实体弧角shape

应用场景:弹窗,对话框

这里写图片描述

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
    android:topLeftRadius="12dp" <!-- 左上角 -->
    android:topRightRadius="12dp" <!-- 右上角 --> 
    android:bottomLeftRadius="12dp" <!-- 左下角 --> 
    android:bottomRightRadius="12dp"/> <!-- 右下角 --> 
    <solid
        android:color="#24A7F2"/>
</shape>

3、带边框的圆角shape

应用场景:按钮

这里写图片描述

<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <solid android:color="#00000000" /><!-- 背景填充颜色 -->
    <stroke
        android:width="2dp"
        android:color="#FF5252" /><!-- 描边,边框宽度、颜色 -->
    <corners android:radius="100dp" /><!-- 边角圆弧的半径 -->

</shape>
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值