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" />


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap