【发布时间】:2018-10-04 15:55:57
【问题描述】:
我正在尝试绘制一个可绘制的布局背景,它只是具有 1-2 dp 高度的渐变下划线,其余部分是透明的,因此上部将具有父级的背景。
这就是我所拥有的。
<?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>
如果我将“主色”中的纯色更改为透明,整个背景将使用“下划线颜色”设置。
【问题讨论】:
-
不幸的是,这对我试图实现的目标没有帮助。渐变必须是水平的,而不是垂直的。
-
据我了解,您需要正确的下划线吗?