Android : Remove ListView Separator/divider programmatically or using xml property


The default behavior of Android ListView has a divider line that acts as a separator between two rows as shown in the below image,

If you wish to remove this line, it's possible both programmatically as well as using layout XML attributes, let's see both ways,

Remove ListView separator using XML property:

To remove the separator using XML property you must simply add android:divider="@null" property to the ListView View that you have defined in the layout file.

File: ListView Snippet
<ListView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/listViewWithoutSeperator"
     android:divider="@null"
     android:layout_below="@+id/fb_login_button"
     android:layout_toRightOf="@+id/fb_login_button"
     android:layout_toEndOf="@+id/fb_login_button"
     android:layout_marginTop="150dp" />



Recent Posts:




Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.