写一个对话框,UI要求实现这个背景,使用sharp实现,顶部背景上面有圆角,下面没有圆角,so easy!,新建sharp文件
将corners上面的设置为8dp,下面设置为0,结果报错:Different corner sizes are not supported in Path.addRoundRect,
解决方法:采用layer-list实现,就是两张图片叠加覆盖掉下面的圆角
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <solid android:color="@color/newColor2" /> <corners android:radius="8dp"/> </shape> </item> <item android:top="8dp" > <shape android:shape="rectangle"> <solid android:color="@color/newColor2" /> </shape> </item> </layer-list>
时间: 2024-10-25 16:36:59