I have been following the answer for this question Making a triangle shape using xml definitions?.
I need to create a triangle that looks like arrow to be placed at the end of selected list item (see attached photos).
I have managed to get it working by do the following:
shape_diamond.xml
-----------------
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<rotate android:fromDegrees="45" android:toDegrees="45">
<shape android:shape="rectangle">
<stroke android:color="@color/color_transparent" android:width="10dp"/>
<solid android:color="@color/color_gray" />
</shape>
</rotate>
</item>
</layer-list>
And create a new selector
selector_list_item.xml
----------------------
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true">
<layer-list>
<item android:drawable="@color/color_orange" />
<item android:width="28dp"
android:height="28dp"
android:right="-14dp"
android:gravity="center|right"
android:drawable="@drawable/shape_diamond" />
</layer-list>
</item>
<item android:state_selected="true">
<layer-list>
<item android:drawable="@color/color_orange" />
<item android:width="28dp"
android:height="28dp"
android:right="-14dp"
android:gravity="center|right"
android:drawable="@drawable/shape_diamond" />
</layer-list>
</item>
<item android:state_focused="true">
<layer-list>
<item android:drawable="@color/color_orange" />
<item android:width="28dp"
android:height="28dp"
android:right="-14dp"
android:gravity="center|right"
android:drawable="@drawable/shape_diamond" />
</layer-list>
</item>
<item android:drawable="@color/color_transparent" />
</selector>
Everything works well for API 23+ because it supports "WIDTH" attribute. But it doesn't work in API below 23.
Does anyone know how to make it work for API that is below API 23 which does not support the "WIDTH" attribute?