Saturday, June 29, 2013

Draw dotted/dashed line in Android?


You can make use of the below code to draw a dotted or dashed line in Android.
drawable/dotted.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
    <stroke
       android:color="#C7B299"
       android:dashWidth="10px"
       android:dashGap="10px" />
</shape>
somefile.xml:
<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/dotted" />

No comments:

Post a Comment