我不明白这段代码是怎么回事。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="10dp">
<shape android:shape="rectangle" >
<solid android:color="#ff8898A4" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#ffD6DDD8"
android:startColor="#ffB1BBC3" />
</shape>
</item>
</layer-list>
如果将实体移动到渐变下方,则不会显示渐变。但现在的情况是,固体不会显示出来。我没有遇到任何问题的两个固体。我做错了什么?
您将实心形状项放置在渐变形状项上。
您需要为渐变形状添加一些填充。你正在做相反的事情,将填充添加到实心形状与渐变形状,试试这个:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#ff8898A4" />
</shape>
</item>
<item android:bottom="10dp">
<shape android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#ffD6DDD8"
android:startColor="#ffB1BBC3" />
</shape>
</item>
</layer-list>
第二个矩形完全覆盖第一个矩形。图层列表中的项目从第一个开始依次绘制。如果没有任何偏移,则它们都具有相同的大小。