【Android开发】控件外边框自定义
1、在drawable里面新建自定义的资源文件shape
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp"/>
<solid android:color="@color/transparent"/>
<stroke
android:width="3dp"
android:color="@color/loginGreenColor"/>
<padding
android:bottom="5dp"
android:left="10dp"
android:right="10dp"
android:top="5dp"/>
</shape>
solid:控件的颜色
stroke:边框的大小和颜色 width:边框的宽度 color:外边框的颜色
corners:设置控件边角的弧度,可设置radius的大小设置边角的弧度
2、在控件的background属性里面引用自定义的资源文件即可
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步