vinb
vinb

Reputation: 113

Android L is not able to draw dotted line as drawable background

Android L is not able to draw dotted line as drawable background as below:

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item> 
<shape  android:shape="line" >

    <stroke
        android:dashGap="1dp"
        android:dashWidth="1dp"
        android:color="#999999" />

    <size android:height="1dp" />

    </shape>
</item>
</selector>

I am also using layerType='software' in xml. Kindly help.

Upvotes: 6

Views: 1810

Answers (1)

Itai Hanski
Itai Hanski

Reputation: 8700

1.The view must be at least 2dp in height (or wrap_content), in order for it to display since a stroke is designed to go around the view and it doesn't have room to do so in 1dp.

2.Add width to your xml:

<stroke
    android:width="1dp"
    android:dashGap="1dp"
    android:dashWidth="1dp"
    android:color="#999999" />

<size android:height="1dp" 
    android:width="1dp"/>

3.Use layerType='software'

Upvotes: 14

Related Questions