Remove ListView separator(in the xml layout file)
AndroidAndroid ListviewAndroid Problem Overview
How can I remove the rows separator in a ListView
(if possible within the XML layout file where it's described)?
Android Solutions
Solution 1 - Android
Set the dividerHeight to zero and divider to null like this in xml:
android:dividerHeight="0dp"
android:divider="@null"
Or in java:
getListView().setDividerHeight(0);
getListView().setDivider(null);
Solution 2 - Android
Simply put:
android:divider="@null"
Solution 3 - Android
put below property in listview tag (in xml file)
android:divider="@null"
Solution 4 - Android
You can set divider color as transparent color and divider height in 'ListView' properties to remove the divider like below:
android:divider="#00000000"
android:dividerHeight="0dp"
Solution 5 - Android
There are different ways to achieve this, but I'm not sure which one is the best (I don't even know is there is a best way). I know at least 2 different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
android:divider="@null" (this goes inside your ListView element)
2. Set divider to transparent and set its height to 0 to avoid adding space between listview elements:
2.1. Programmatically:
yourListView.setDivider(new ColorDrawable(android.R.color.transparent));
yourListView.setDividerHeight(0);
2.2. XML
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
Solution 6 - Android
Only -1dp helps me to remove divider (not 0, 0.0, @null or the same in code)
Android Studio, SDK L, android 4.2