Hardik Gajjar
Hardik Gajjar

Reputation: 5058

How to remove the border in a Listview?

On Android, how can the Line which appears in a listview at the bottom of Lists be removed?

Upvotes: 46

Views: 39075

Answers (6)

scarfanat
scarfanat

Reputation: 1

You can set this property in your Style:

<ListView.Resources>
    <Style TargetType="ListView">
        <Setter Property="SeparatorVisibility" Value="None"/>
    </Style>
</ListView.Resources>

Upvotes: 0

sivi
sivi

Reputation: 11114

Great answers. I decided to use this in ListView for better readability than colour "#00xxxxxx". transparent is a system colour available by android platform.

 android:divider="@android:color/transparent"

Upvotes: 6

Denny Sharma
Denny Sharma

Reputation: 3035

Please write this one after defining your listview:

Yourlistview.setDivider(null); // Will remove the divider

Upvotes: 2

duggu
duggu

Reputation: 38439

see this link to more info:-

getListView().setDivider(null);
getListView().setDividerHeight(0);

Or, if you want to do it in XML:

android:divider="@null"
android:dividerHeight="0dp"

Upvotes: 20

Rohit Mandiwal
Rohit Mandiwal

Reputation: 10462

do this

myListview.setDivider(null);

This should help you.

Upvotes: 86

Daniel
Daniel

Reputation: 2662

Another option would be to set a transparent color for the android:divider attribute:

<ListView 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:divider="#00000000"
/>

Upvotes: 56

Related Questions