shape使用总结

本文总结了Android中Shape的使用,包括圆角矩形、圆柱、圆形、带边框的几何形状、渐变效果、环形渐变、发光效果、虚线边框以及带阴影的渐变圆环,并特别指出在实现虚线边框时,需要禁用硬件加速以确保显示正确。
摘要由CSDN通过智能技术生成

圆角矩形

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <corners android:radius="5.0dp" />
    <solid android:color="#f09738" />
</shape>

这里写图片描述


圆柱

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/colorAccent" />
    <size
        android:width="15dp"
        android:height="15dp" />
    <corners android:radius="40dp" />
</shape>

这里写图片描述


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <size
        android:width="15dp"
        android:height="15dp" />
    <solid android:color="#f09738" />
</shape>

这里写图片描述


带边框的圆角矩形(圆柱带边框,圆形带边框同理)

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <corners android:radius="5.0dp" />
    <solid android:color="#f09738" />

    <stroke android:width="3dp"
        android:color="#ffffff"/>
</shape>

这里写图片描述


渐变

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值