可绘制的XML中的Android多冲程盒
题
我正在尝试实现在一个矩形上有效2笔的量 <shape>
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”应用于第二个项目元素,但是当我添加右和左属性时,整个内容都不会呈现。请注意,这一切都是在listView中完成的
解决方案
好吧,我相信我通过工作解决了这一问题。它很漂亮,但可以正常工作。我所做的是设置一个imageView,以将背景颜色设置为外线颜色,使其填充1DIP,然后将ImageView的SRC设置为可绘制的src,然后我达到了所需的效果。也就是说,我更喜欢能够在层列表中完成所有工作...
不隶属于 StackOverflow