我正在尝试创建一个布局背景可绘制对象,它只有1-2dp高度的渐变下划线,其余部分是透明的,因此上部将具有父元素的背景。
以下是我所拥有的。
如果我将“主要颜色”中的实心颜色更改为透明,则整个背景将使用“下划线颜色”设置。
以下是我所拥有的。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android>
<!-- underline color -->
<item>
<shape>
<gradient
android:startColor="@color/colorPrimaryDark"
android:endColor="#FFFFFFFF"
android:centerY="0.5"
android:angle="0"/>
</shape>
</item>
<!-- main color -->
<item android:bottom="2.5dp">
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<padding
android:top="4dp"
android:bottom="4dp" />
</shape>
</item>
如果我将“主要颜色”中的实心颜色更改为透明,则整个背景将使用“下划线颜色”设置。