Skip to content →

Remove Divider in an Android ListView

I’ve had to remove the divider in an Android ListView several times now, so here’s a quick reminder of myself.

This can be done in XML or in Java by setting the dividerHeight to 0 and the divider to null:

XML


<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="0dp"
android:divider="@null"/>

Java


ListView listView = 
(ListView)findViewById(R.id.listView);
listView.setDividerHeight(0);
listView.setDivider(null);

Published in Android ListView