Android - How to add a dashed/dotted separator line for RecyclerView?
<p>I have used the code from <a href="https://stackoverflow.com/a/31243174/1617737">this answer</a> to create a solid separator line for my <code>RecyclerView</code>s.</p>

<p>However, I would like the line to be dashed/dotted.</p>

<p>I already have a <code>line_dashed.xml</code> resource that I am using elsewhere in my app:</p>

<pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="line" &gt;

    &lt;stroke
        android:color="@color/blue"
        android:dashGap="12dp"
        android:dashWidth="12dp"
        android:width="1dp" /&gt;

&lt;/shape&gt;
</code></pre>

<p>But if I try applying this as the drawable resource that is accessed via my call to <code>recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getContext()))</code>, no line is drawn at all.</p>

<p>How to solve so a dashed line is shown?</p>