Friday 15 April 2011

Using a custom drawable to have a dotted line as a background in Android Lollipop (on Nexus 5) -



Using a custom drawable to have a dotted line as a background in Android Lollipop (on Nexus 5) -

so far, used imageview (or view, result same) draw dotted line in custom listview between each item. xml layout this:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!-- random stuff --> <imageview android:layout_width="match_parent" android:layout_height="1dp" android:src="@drawable/dotted_line" /> </linearlayout>

my drawable looks like:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:dashgap="1dp" android:dashwidth="1dp" /> </shape>

i tried wrap shape selector, or add together android:layertype="software" in imageview, nil worked. have seen people suggesting create imageview height bigger, or play width of dotted line. best render accomplish drawing solid line, not dotted line looking for.

can help me draw doted line ? should utilize method drawable ? thanks!

android android-layout android-drawable

No comments:

Post a Comment