Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove ListView separator(in the xml layout file) [duplicate]

People also ask

How to remove ListView divider in android?

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.

How to remove list view line in android?

This example demonstrates how do I remove lines between listviews on android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

What is setAdapter in android?

A list view is an adapter view that does not know the details, such as type and contents, of the views it contains. Instead list view requests views on demand from a ListAdapter as needed, such as to display new views as the user scrolls up or down. In order to display items in the list, call setAdapter(android.

How does ListView work android?

Android ListView is a ViewGroup that is used to display the list of items in multiple rows and contains an adapter that automatically inserts the items into the list. The main purpose of the adapter is to fetch data from an array or database and insert each item that placed into the list for the desired result.


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);

Simply put:

android:divider="@null"

put below property in listview tag (in xml file)

android:divider="@null"

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"