android - Bottom Rounded Corners - Android
问题描述
I have been trying to fix this but for whatever I do, I just cannot get the Bottom Rounded Corners the way I want, I am using the following
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<stroke android:width="0dp" />
<solid android:color="?attr/colorPrimaryDark" />
</shape>
</item>
<item android:top="0dp" android:bottom="1dp">
<shape
android:shape="rectangle">
<stroke android:width="0dp"/>
<solid android:color="?attr/colorPrimary"/>
<corners android:radius="15dp" android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="0dp" android:topRightRadius="0dp"/>
</shape>
</item>
</layer-list>
The Results are the following
It creates the corners but it adds grey color (colorPrimaryDark
) to it where I want it to be white (colorPrimary"
) with a grey line - Any idea how I accomplish this?
解决方案
If you only want bottom border a Shape drawable will be enough . You do not need a layer-list
for it .
try this
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="@color/green"/>
<solid android:color="?attr/colorPrimary" />
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp" />
</shape>
The problem with your current code is first item have a solid color set . this is why the gray part showing .
推荐阅读
- java - 试图在java中的上限内找到一个完美数而不创建方法
- c# - Web 应用在 Visual Studio 和 Azure 上显示不同的屏幕
- python - Python numpy 数组保持整数
- vb.net - VB.net 中的多项选择测验
- c - 如何在 Windows 10 中正确拦截(挂钩)IME 输入?
- python - 单元测试多输入/输出测试
- flutter - 添加所需的参数'key'
- sql - 从两个会话更新相同的值会导致 Oracle 中的死锁吗?
- angular - 实现套接字处理程序Angular Typescript的问题
- javascript - 如何去掉水平滚动条