我正在尝试在Android的可绘制XML文件中,实现一个矩形上的两种效果:一种是深绿色的外边框,另一种是浅绿色的内边框,中心部分填充有渐变色。目前我的代码如下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="3px" android:color="#477135" />
</shape>
</item>
<item >
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#81c557" android:endColor="#539942"
android:angle="270" />
<stroke android:width="1px" android:color="#a8d78a" />
</shape>
</item>
我尝试将android:top="3px" android:bottom="3px"应用于第二个元素,但当我添加right和left属性时,整个内容无法渲染。请注意,这都是在ListView中完成的。