How to remove the border in a Listview?
Asked Answered
Y

6

46

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

Yordan answered 24/3, 2011 at 4:49 Comment(0)
C
86

do this

myListview.setDivider(null);

This should help you.

Cohbert answered 24/3, 2011 at 5:6 Comment(2)
If you are inside an activity that extends ListActivity (custom adapter), it would be getListView().setDivider(null);Mores
@rohitmandiwal can you help answer this question please? #37358515Alinealinna
C
56

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"
/>
Compartment answered 18/7, 2011 at 16:2 Comment(1)
I like this better; configuring things like dividers should be less obtrusive.Tildi
T
20

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"
Threw answered 18/6, 2013 at 12:4 Comment(0)
P
6

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"
Passional answered 28/3, 2016 at 9:52 Comment(0)
P
2

Please write this one after defining your listview:

Yourlistview.setDivider(null); // Will remove the divider
Prearrange answered 25/9, 2013 at 9:20 Comment(0)
G
0

You can set this property in your Style:

<ListView.Resources>
    <Style TargetType="ListView">
        <Setter Property="SeparatorVisibility" Value="None"/>
    </Style>
</ListView.Resources>
Graniteware answered 31/3 at 18:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.