質問

私は、の長方形に効果的に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"を2番目のアイテム要素に適用しようとしましたが、右属性と左属性を追加すると、全体はレンダリングされません。注意してください、これはすべてリストビュー内で行われます

役に立ちましたか?

解決

まあ、私はこれを回避することでこれを解決したと思います。それはきれいではありませんが、うまくいきます。私がしたことは、背景色を外側の線の色に設定するようにImageViewを設定し、1DIPのパディングを与えてから、ImageViewのSRCを描画可能に設定し、探していた効果を達成しました。そうは言っても、私はこれをすべてレイヤーリスト内で行うことができることを非常に好みます...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top