<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!--思路:设置双层填充色,让上层比下层小,那么下层比上层多的就是边框了--> <item> <shape> <!-- 边框颜色 --> <solid android:color="@color/lineColor" /> </shape> </item> <!-- 想保留哪一边就设置哪一边边框就好了,列如只有上边框:top="1dp" --> <item android:bottom="1px"> <shape> <solid android:color="@android:color/white" /> </shape> </item> </layer-list>
android中shape实现非全边框
最新推荐文章于 2024-08-18 03:50:33 发布