How do I make a dotted/dashed line in Android?

Without java code:

android:dashGap means here is the distance between line dashes.

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> 

view.xml:
 
<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/dotted" />

Bu blogdaki popüler yayınlar

About Android padding, margin, width, height, wrap_content, match_parent, R Class