xml中的自定义直线路径

时间:2014-08-12 21:07:11

标签: android android-drawable

我想有一个类似于下图的drawable。

Desired outcome

我想我需要4条线; 2为尖端,每侧为1。我不明白如何:

  • 给出2条尖端线长度(例如:5dp)
  • 相对于彼此的位置线(水平堆叠)
  • 允许侧线扩展以填充父级(一个具有X%的空间,另一个具有100-tip-X)%。

这是我到目前为止所做的:     

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="line">
            <stroke
                android:width="1dp"
                android:color="#336699"/>
        </shape>
    </item>
    <item>
        <rotate
            android:fromDegrees="135"
            android:toDegrees="135">
            <shape android:shape="line">
                <stroke
                    android:width="1dp"
                    android:color="#330000"/>
            </shape>
        </rotate>
    </item>
    <item>
        <rotate
            android:fromDegrees="45"
            android:toDegrees="45">
            <shape android:shape="line">
                <stroke
                    android:width="1dp"
                    android:color="#000033"/>
            </shape>
        </rotate>
    </item>
    <item>
        <shape android:shape="line">
            <stroke
                android:width="1dp"
                android:color="#336699"/>
        </shape>
    </item>
</layer-list>

有人能指出我正确的方向吗?

0 个答案:

没有答案
相关问题