Issue
I would like to achieve something like this:
This is my code. I unsuccessfully played with different attributes but nothing helped so far. This is what I get. Colors are not important here
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<rotate
android:fromDegrees="0"
android:pivotX="-45%"
android:pivotY="-45%">
<shape
android:shape="rectangle" >
<stroke android:color="@color/gray" android:width="1dp"/>
<solid
android:color="@color/gray" />
</shape>
</rotate>
</item>
<item>
<rotate
android:fromDegrees="45"
android:pivotX="0%"
android:pivotY="100%">
<shape
android:shape="rectangle" >
<stroke android:color="@color/gray" android:width="1dp"/>
<solid
android:color="@color/occupationGreen" />
</shape>
</rotate>
</item>
Solution
This is solution: (vector drawables)
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="100dp"
android:width="100dp"
android:viewportHeight="100"
android:viewportWidth="100" >
<group
android:name="triableGroup">
<path
android:name="triangle"
android:fillColor="#00C717"
android:pathData="m 100,0 l 0,100 -100,0 z" />
</group>
you cannot use @color references for colors otherwise it will work only for L+
Answered By - Vlado Pandžić
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.