Issue
How can a vertical line be drawn within an XML drawable when using a layer-list
? I declared 3 shapes within the drawable but for some reason it doesn't appear as expected.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/green"/>
</shape>
</item>
<item android:top="0dp" android:left="1dp" android:bottom="0dp" android:right="5dp">
<shape android:shape="rectangle">
<size android:width="3dp"/>
<solid android:color="@android:color/white"/>
</shape>
</item>
<item android:top="0dp" android:left="5dp" android:bottom="0dp" android:right="1dp">
<shape android:shape="rectangle">
<size android:width="3dp"/>
<solid android:color="@android:color/white"/>
</shape>
</item>
</layer-list>
Current result
Expected result
Solution
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="16dp"
android:left="15px">
<shape
android:shape="rectangle">
<solid android:color="@color/colorAccent" />/>
<size android:width="5dip" />
<stroke android:color="@color/colorAccent" />
</shape>
</item>
<item
android:width="16dp"
android:left="80px">
<shape
android:shape="rectangle">
<solid android:color="@color/colorAccent" />/>
<size android:width="5dip" />
<stroke android:color="@color/colorAccent" />
</shape>
</item>
<item
android:width="16dp"
android:left="140px">
<shape
android:shape="rectangle">
<solid android:color="@color/colorAccent" />/>
<size android:width="5dip" />
<stroke android:color="@color/colorAccent" />
</shape>
</item>
</layer-list>
Answered By - Valdio
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.