Search code examples
androiddivider

Create a custom divider in a layout


I want to draw a custom divider in my layout. I know how to draw a straight line divider, but I want something similar to this:

Criss-crossed line divider

I want the criss-cross lines to be the divider and set the view's background to the same as how we would do it here:

<View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="@android:color/darker_gray"/>

Solution

  • You can use a tiled xml bitmap.

    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/back" 
        android:tileMode="repeat" />