我正在尝试通过 XML 创建一个应该如下所示的背景:
纯白色背景,其中渐变位于此视图的顶部和底部以显示阴影。
我知道我可以通过使用多个视图来创建它并为每个视图创建一个可绘制的背景,但我认为可能有更好的解决方案!?
我尝试使用图层列表,但因为我无法设置“heigh”和/或“alignParentBottom”或类似的渐变的alpha,所以你看不到阴影......
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow Stack -->
<item android:bottom="15dp">
<shape>
<gradient
android:centerColor="#000"
android:endColor="#0000"
android:angle="90"/>
</shape>
</item>
<!-- base background -->
<item android:bottom="15dp" android:top="15dp">
<shape android:shape="rectangle">
<solid android:color="#fff"/>
</shape>
</item>
</layer-list>
也许那里有人知道我的意思,也许还有一个解决方案!?