miércoles, 18 de enero de 2017

Android Dotted Vertical Line

To draw a vertical dotted lines in android using shapes. You can use the following code:

Dotted.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:right="-3px"
        android:bottom="-3px"
        android:top="-3px">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">

            <stroke
                android:width="2px"
                android:color="@color/negro"
                android:dashGap="2px"
                android:dashWidth="3px" />
        </shape>
    </item>

</layer-list>


Layout

<ImageView
    android:id="@+id/dotted"
    android:layout_gravity="center"
    android:src="@drawable/dotted"
    android:layout_width="4dp"
    android:layout_height="match_parent"
    />


Result: