How do I remove lines between ListViews on Android?
up vote
355
down vote
favorite
I'm using two ListView
s like this:
<ListView
android:id="@+id/ListView"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
<ListView
android:id="@+id/ListView1"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
There is one blank line between the two ListView
s. How do I remove it?
android android-layout listview
add a comment |
up vote
355
down vote
favorite
I'm using two ListView
s like this:
<ListView
android:id="@+id/ListView"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
<ListView
android:id="@+id/ListView1"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
There is one blank line between the two ListView
s. How do I remove it?
android android-layout listview
3
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26
add a comment |
up vote
355
down vote
favorite
up vote
355
down vote
favorite
I'm using two ListView
s like this:
<ListView
android:id="@+id/ListView"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
<ListView
android:id="@+id/ListView1"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
There is one blank line between the two ListView
s. How do I remove it?
android android-layout listview
I'm using two ListView
s like this:
<ListView
android:id="@+id/ListView"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
<ListView
android:id="@+id/ListView1"
android:text="@string/Website"
android:layout_height="30px"
android:layout_width="150px"
android:scrollbars="none"
android:transcriptMode="normal"/>
There is one blank line between the two ListView
s. How do I remove it?
android android-layout listview
android android-layout listview
edited Jan 20 '17 at 12:27
Vadim Kotov
4,25153247
4,25153247
asked Dec 16 '09 at 12:49
deepthi
3,456123033
3,456123033
3
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26
add a comment |
3
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26
3
3
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26
add a comment |
12 Answers
12
active
oldest
votes
up vote
858
down vote
To remove the separator between items in the same ListView, here is the solution:
getListView().setDivider(null);
getListView().setDividerHeight(0);
developer.android.com # ListView
Or, if you want to do it in XML:
android:divider="@null"
android:dividerHeight="0dp"
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
|
show 5 more comments
up vote
89
down vote
If you want to remove a divider line, use this code:
android:divider="@null"
If you want to add a space instead of a divider line:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
So, you can use any drawable or color in the divider attribute.
add a comment |
up vote
62
down vote
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 two different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
This goes inside your ListView element.
android:divider="@null"
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"
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
add a comment |
up vote
25
down vote
In XML:
android:divider="@null"
Or in Java:
listView.setDivider(null);
add a comment |
up vote
12
down vote
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"/>
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
add a comment |
up vote
10
down vote
You can put below property in listview tag
android:divider="@null"
(or)
programmatically listview.Divider(null);
here listview
is ListView
reference.
add a comment |
up vote
10
down vote
Or in XML:
android:divider="@drawable/list_item_divider"
android:dividerHeight="1dp"
You can use a color for the drawable (e.g. #ff112233), but be aware, that pre-cupcake releases have a bug in which the color cannot be set. Instead a 9-patch or a image must be used..
Or you can even use the standard Android drawable for the divider:@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
add a comment |
up vote
9
down vote
Set divider to null:
JAVA
listview_id.setDivider(null);
XML
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
/>
add a comment |
up vote
8
down vote
You can try the following. It worked for me...
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
add a comment |
up vote
6
down vote
I find it easier to implement it in the XML file as it can be harder to trace the line of code in a class with hundreds of lines.
For the XML you can use "null":
android:divider="@null"
add a comment |
up vote
4
down vote
For ListFragment use
getListView().setDivider(null)
after the list has been obtained.
add a comment |
up vote
0
down vote
If this android:divider="@null"
doesn't work, maybe changing your ListViews for Recycler Views?
add a comment |
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
858
down vote
To remove the separator between items in the same ListView, here is the solution:
getListView().setDivider(null);
getListView().setDividerHeight(0);
developer.android.com # ListView
Or, if you want to do it in XML:
android:divider="@null"
android:dividerHeight="0dp"
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
|
show 5 more comments
up vote
858
down vote
To remove the separator between items in the same ListView, here is the solution:
getListView().setDivider(null);
getListView().setDividerHeight(0);
developer.android.com # ListView
Or, if you want to do it in XML:
android:divider="@null"
android:dividerHeight="0dp"
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
|
show 5 more comments
up vote
858
down vote
up vote
858
down vote
To remove the separator between items in the same ListView, here is the solution:
getListView().setDivider(null);
getListView().setDividerHeight(0);
developer.android.com # ListView
Or, if you want to do it in XML:
android:divider="@null"
android:dividerHeight="0dp"
To remove the separator between items in the same ListView, here is the solution:
getListView().setDivider(null);
getListView().setDividerHeight(0);
developer.android.com # ListView
Or, if you want to do it in XML:
android:divider="@null"
android:dividerHeight="0dp"
edited May 3 '11 at 14:26
Lyudmil
73021121
73021121
answered Dec 16 '09 at 13:12
dasilvj
9,16021216
9,16021216
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
|
show 5 more comments
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
2
2
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
for some reason, setting it in the XML didn't work for me. had to set it in the code.
– Jeffrey Blattman
Aug 29 '12 at 17:20
8
8
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
Worked in XML for me. Should put in the <ListView></Listview>. Wonder why this was not accepted as the right answer.
– zolio
Jan 5 '13 at 3:30
3
3
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
android:showDividers="none" worked for me
– moonlightdock
Feb 25 '13 at 9:55
3
3
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
@Pranav. Please teacher, let's write about programming. Thank you.
– Geltrude
Oct 16 '14 at 7:22
1
1
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
Weirdly only dividerHeight=0 didnt work, only divider=@null did. Why?
– Chintan Shah
Mar 24 '15 at 11:34
|
show 5 more comments
up vote
89
down vote
If you want to remove a divider line, use this code:
android:divider="@null"
If you want to add a space instead of a divider line:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
So, you can use any drawable or color in the divider attribute.
add a comment |
up vote
89
down vote
If you want to remove a divider line, use this code:
android:divider="@null"
If you want to add a space instead of a divider line:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
So, you can use any drawable or color in the divider attribute.
add a comment |
up vote
89
down vote
up vote
89
down vote
If you want to remove a divider line, use this code:
android:divider="@null"
If you want to add a space instead of a divider line:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
So, you can use any drawable or color in the divider attribute.
If you want to remove a divider line, use this code:
android:divider="@null"
If you want to add a space instead of a divider line:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
So, you can use any drawable or color in the divider attribute.
edited Aug 7 '16 at 0:13
Peter Mortensen
13.3k1983111
13.3k1983111
answered Dec 30 '13 at 12:31
Amintabar
1,52111418
1,52111418
add a comment |
add a comment |
up vote
62
down vote
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 two different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
This goes inside your ListView element.
android:divider="@null"
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"
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
add a comment |
up vote
62
down vote
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 two different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
This goes inside your ListView element.
android:divider="@null"
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"
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
add a comment |
up vote
62
down vote
up vote
62
down vote
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 two different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
This goes inside your ListView element.
android:divider="@null"
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"
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 two different ways to do this in a ListView:
1. Set divider to null:
1.1. Programmatically
yourListView.setDivider(null);
1.2. XML
This goes inside your ListView element.
android:divider="@null"
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"
edited Aug 7 '16 at 0:15
Peter Mortensen
13.3k1983111
13.3k1983111
answered Jul 9 '14 at 12:00
Sotti
10.5k23639
10.5k23639
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
add a comment |
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
1
1
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
In certain situations there seems to be an issue with simply setting the divider color to transparent. My ListView elements each had a solid-colored, semi-transparent background. When I was using the second method of hiding the divider, a "divider" still seemed to appear. When I switched to the first method, the "divider" disappeared.
– themarshal
Nov 30 '15 at 21:40
add a comment |
up vote
25
down vote
In XML:
android:divider="@null"
Or in Java:
listView.setDivider(null);
add a comment |
up vote
25
down vote
In XML:
android:divider="@null"
Or in Java:
listView.setDivider(null);
add a comment |
up vote
25
down vote
up vote
25
down vote
In XML:
android:divider="@null"
Or in Java:
listView.setDivider(null);
In XML:
android:divider="@null"
Or in Java:
listView.setDivider(null);
edited Aug 7 '16 at 0:35
Peter Mortensen
13.3k1983111
13.3k1983111
answered Jul 31 '16 at 13:39
Khalid Taha
1,3691527
1,3691527
add a comment |
add a comment |
up vote
12
down vote
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"/>
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
add a comment |
up vote
12
down vote
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"/>
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
add a comment |
up vote
12
down vote
up vote
12
down vote
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"/>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"/>
answered Jan 25 '17 at 13:37
Muhammad Shafqat
12112
12112
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
add a comment |
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
1
1
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
– Donald Duck
Jan 25 '17 at 13:54
add a comment |
up vote
10
down vote
You can put below property in listview tag
android:divider="@null"
(or)
programmatically listview.Divider(null);
here listview
is ListView
reference.
add a comment |
up vote
10
down vote
You can put below property in listview tag
android:divider="@null"
(or)
programmatically listview.Divider(null);
here listview
is ListView
reference.
add a comment |
up vote
10
down vote
up vote
10
down vote
You can put below property in listview tag
android:divider="@null"
(or)
programmatically listview.Divider(null);
here listview
is ListView
reference.
You can put below property in listview tag
android:divider="@null"
(or)
programmatically listview.Divider(null);
here listview
is ListView
reference.
edited Sep 29 '13 at 9:04
JoeBilly
2,7772233
2,7772233
answered Sep 29 '13 at 8:40
Sandeep Reddy M
2,82012633
2,82012633
add a comment |
add a comment |
up vote
10
down vote
Or in XML:
android:divider="@drawable/list_item_divider"
android:dividerHeight="1dp"
You can use a color for the drawable (e.g. #ff112233), but be aware, that pre-cupcake releases have a bug in which the color cannot be set. Instead a 9-patch or a image must be used..
Or you can even use the standard Android drawable for the divider:@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
add a comment |
up vote
10
down vote
Or in XML:
android:divider="@drawable/list_item_divider"
android:dividerHeight="1dp"
You can use a color for the drawable (e.g. #ff112233), but be aware, that pre-cupcake releases have a bug in which the color cannot be set. Instead a 9-patch or a image must be used..
Or you can even use the standard Android drawable for the divider:@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
add a comment |
up vote
10
down vote
up vote
10
down vote
Or in XML:
android:divider="@drawable/list_item_divider"
android:dividerHeight="1dp"
You can use a color for the drawable (e.g. #ff112233), but be aware, that pre-cupcake releases have a bug in which the color cannot be set. Instead a 9-patch or a image must be used..
Or in XML:
android:divider="@drawable/list_item_divider"
android:dividerHeight="1dp"
You can use a color for the drawable (e.g. #ff112233), but be aware, that pre-cupcake releases have a bug in which the color cannot be set. Instead a 9-patch or a image must be used..
edited Sep 5 '15 at 11:20
Jared Rummler
28.7k1392119
28.7k1392119
answered Dec 16 '09 at 13:27
Mads Kristiansen
1,3471013
1,3471013
Or you can even use the standard Android drawable for the divider:@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
add a comment |
Or you can even use the standard Android drawable for the divider:@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
Or you can even use the standard Android drawable for the divider:
@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
Or you can even use the standard Android drawable for the divider:
@android:drawable/divider_horizontal_...
– racs
Jun 17 '16 at 1:44
add a comment |
up vote
9
down vote
Set divider to null:
JAVA
listview_id.setDivider(null);
XML
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
/>
add a comment |
up vote
9
down vote
Set divider to null:
JAVA
listview_id.setDivider(null);
XML
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
/>
add a comment |
up vote
9
down vote
up vote
9
down vote
Set divider to null:
JAVA
listview_id.setDivider(null);
XML
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
/>
Set divider to null:
JAVA
listview_id.setDivider(null);
XML
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
/>
edited Apr 30 at 5:15
answered Dec 28 '17 at 21:01
Saneesh
602515
602515
add a comment |
add a comment |
up vote
8
down vote
You can try the following. It worked for me...
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
add a comment |
up vote
8
down vote
You can try the following. It worked for me...
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
add a comment |
up vote
8
down vote
up vote
8
down vote
You can try the following. It worked for me...
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
You can try the following. It worked for me...
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
edited Aug 7 '16 at 0:06
Peter Mortensen
13.3k1983111
13.3k1983111
answered Sep 16 '13 at 10:36
Zia
8401910
8401910
add a comment |
add a comment |
up vote
6
down vote
I find it easier to implement it in the XML file as it can be harder to trace the line of code in a class with hundreds of lines.
For the XML you can use "null":
android:divider="@null"
add a comment |
up vote
6
down vote
I find it easier to implement it in the XML file as it can be harder to trace the line of code in a class with hundreds of lines.
For the XML you can use "null":
android:divider="@null"
add a comment |
up vote
6
down vote
up vote
6
down vote
I find it easier to implement it in the XML file as it can be harder to trace the line of code in a class with hundreds of lines.
For the XML you can use "null":
android:divider="@null"
I find it easier to implement it in the XML file as it can be harder to trace the line of code in a class with hundreds of lines.
For the XML you can use "null":
android:divider="@null"
edited Aug 7 '16 at 0:35
Peter Mortensen
13.3k1983111
13.3k1983111
answered Aug 27 '15 at 14:29
Fred
20435
20435
add a comment |
add a comment |
up vote
4
down vote
For ListFragment use
getListView().setDivider(null)
after the list has been obtained.
add a comment |
up vote
4
down vote
For ListFragment use
getListView().setDivider(null)
after the list has been obtained.
add a comment |
up vote
4
down vote
up vote
4
down vote
For ListFragment use
getListView().setDivider(null)
after the list has been obtained.
For ListFragment use
getListView().setDivider(null)
after the list has been obtained.
answered Apr 27 '14 at 11:42
Meanman
995148
995148
add a comment |
add a comment |
up vote
0
down vote
If this android:divider="@null"
doesn't work, maybe changing your ListViews for Recycler Views?
add a comment |
up vote
0
down vote
If this android:divider="@null"
doesn't work, maybe changing your ListViews for Recycler Views?
add a comment |
up vote
0
down vote
up vote
0
down vote
If this android:divider="@null"
doesn't work, maybe changing your ListViews for Recycler Views?
If this android:divider="@null"
doesn't work, maybe changing your ListViews for Recycler Views?
answered Jun 9 '17 at 17:43
Richard Nikolas
1026
1026
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1914477%2fhow-do-i-remove-lines-between-listviews-on-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Do you have two separate ListViews showing different lists or do you mean you have a line between items in your ListView?
– Dave Webb
Dec 16 '09 at 13:03
Is it "blank" or "black" line? Since the question got edited by someone other than the OP. There is a difference between those
– miva2
Oct 14 '15 at 8:26