我试图用3种或更多种颜色完成单线背景,我想知道它是否可能与xml形状或我必须使用9个补丁?我是一个有形状的新手,我花了整整一个早上试图完成我想要的,但没有。多色线与形状
下面是我想达到的目标:
我媒体链接试过这种形状与梯度,但它只是假设起始色
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is the line -->
<item>
<shape>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="1dp"/>
<solid android:color="#868686" />
</shape>
</item>
<!-- This is the main color -->
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
解决方案Update
除了SAM提供的答案,我发现9.png是我的问题的最佳答案。我简单地创建一个png与3种颜色,然后应用九个补丁和DONE:D我用这个工具weblookandfeel。 com/nine-patch-editor就像在应用程序中打开图像并保存,并且您拥有9.png一样简单。
'layer-list'将把形状/物品放在其他物体上。 – gunar