How do I remove lines between ListViews on Android?











up vote
355
down vote

favorite
75












I'm using two ListViews 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 ListViews. How do I remove it?










share|improve this question




















  • 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

















up vote
355
down vote

favorite
75












I'm using two ListViews 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 ListViews. How do I remove it?










share|improve this question




















  • 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















up vote
355
down vote

favorite
75









up vote
355
down vote

favorite
75






75





I'm using two ListViews 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 ListViews. How do I remove it?










share|improve this question















I'm using two ListViews 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 ListViews. How do I remove it?







android android-layout listview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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














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"





share|improve this answer



















  • 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


















up vote
89
down vote















  1. If you want to remove a divider line, use this code:



    android:divider="@null"



  2. 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.






share|improve this answer






























    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"





    share|improve this answer



















    • 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


















    up vote
    25
    down vote













    In XML:



    android:divider="@null"


    Or in Java:



    listView.setDivider(null);





    share|improve this answer






























      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"/>





      share|improve this answer

















      • 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


















      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.






      share|improve this answer






























        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..






        share|improve this answer























        • Or you can even use the standard Android drawable for the divider: @android:drawable/divider_horizontal_...
          – racs
          Jun 17 '16 at 1:44


















        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"
        />





        share|improve this answer






























          up vote
          8
          down vote













          You can try the following. It worked for me...



          android:divider="@android:color/transparent"
          android:dividerHeight="0dp"





          share|improve this answer






























            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"





            share|improve this answer






























              up vote
              4
              down vote













              For ListFragment use



              getListView().setDivider(null)


              after the list has been obtained.






              share|improve this answer




























                up vote
                0
                down vote













                If this android:divider="@null" doesn't work, maybe changing your ListViews for Recycler Views? 






                share|improve this answer





















                  Your Answer






                  StackExchange.ifUsing("editor", function () {
                  StackExchange.using("externalEditor", function () {
                  StackExchange.using("snippets", function () {
                  StackExchange.snippets.init();
                  });
                  });
                  }, "code-snippets");

                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "1"
                  };
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function() {
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled) {
                  StackExchange.using("snippets", function() {
                  createEditor();
                  });
                  }
                  else {
                  createEditor();
                  }
                  });

                  function createEditor() {
                  StackExchange.prepareEditor({
                  heartbeatType: 'answer',
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader: {
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  },
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  });


                  }
                  });














                   

                  draft saved


                  draft discarded


















                  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

























                  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"





                  share|improve this answer



















                  • 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















                  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"





                  share|improve this answer



















                  • 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













                  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"





                  share|improve this answer














                  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"






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  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














                  • 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












                  up vote
                  89
                  down vote















                  1. If you want to remove a divider line, use this code:



                    android:divider="@null"



                  2. 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.






                  share|improve this answer



























                    up vote
                    89
                    down vote















                    1. If you want to remove a divider line, use this code:



                      android:divider="@null"



                    2. 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.






                    share|improve this answer

























                      up vote
                      89
                      down vote










                      up vote
                      89
                      down vote











                      1. If you want to remove a divider line, use this code:



                        android:divider="@null"



                      2. 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.






                      share|improve this answer
















                      1. If you want to remove a divider line, use this code:



                        android:divider="@null"



                      2. 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.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      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






















                          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"





                          share|improve this answer



















                          • 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















                          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"





                          share|improve this answer



















                          • 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













                          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"





                          share|improve this answer














                          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"






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          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














                          • 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










                          up vote
                          25
                          down vote













                          In XML:



                          android:divider="@null"


                          Or in Java:



                          listView.setDivider(null);





                          share|improve this answer



























                            up vote
                            25
                            down vote













                            In XML:



                            android:divider="@null"


                            Or in Java:



                            listView.setDivider(null);





                            share|improve this answer

























                              up vote
                              25
                              down vote










                              up vote
                              25
                              down vote









                              In XML:



                              android:divider="@null"


                              Or in Java:



                              listView.setDivider(null);





                              share|improve this answer














                              In XML:



                              android:divider="@null"


                              Or in Java:



                              listView.setDivider(null);






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              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






















                                  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"/>





                                  share|improve this answer

















                                  • 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















                                  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"/>





                                  share|improve this answer

















                                  • 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













                                  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"/>





                                  share|improve this answer












                                     <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"/>






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  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














                                  • 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










                                  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.






                                  share|improve this answer



























                                    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.






                                    share|improve this answer

























                                      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.






                                      share|improve this answer














                                      You can put below property in listview tag



                                      android:divider="@null"


                                      (or)
                                      programmatically listview.Divider(null);
                                      here listview is ListView reference.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      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






















                                          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..






                                          share|improve this answer























                                          • Or you can even use the standard Android drawable for the divider: @android:drawable/divider_horizontal_...
                                            – racs
                                            Jun 17 '16 at 1:44















                                          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..






                                          share|improve this answer























                                          • Or you can even use the standard Android drawable for the divider: @android:drawable/divider_horizontal_...
                                            – racs
                                            Jun 17 '16 at 1:44













                                          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..






                                          share|improve this answer














                                          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..







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          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


















                                          • 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










                                          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"
                                          />





                                          share|improve this answer



























                                            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"
                                            />





                                            share|improve this answer

























                                              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"
                                              />





                                              share|improve this answer














                                              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"
                                              />






                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Apr 30 at 5:15

























                                              answered Dec 28 '17 at 21:01









                                              Saneesh

                                              602515




                                              602515






















                                                  up vote
                                                  8
                                                  down vote













                                                  You can try the following. It worked for me...



                                                  android:divider="@android:color/transparent"
                                                  android:dividerHeight="0dp"





                                                  share|improve this answer



























                                                    up vote
                                                    8
                                                    down vote













                                                    You can try the following. It worked for me...



                                                    android:divider="@android:color/transparent"
                                                    android:dividerHeight="0dp"





                                                    share|improve this answer

























                                                      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"





                                                      share|improve this answer














                                                      You can try the following. It worked for me...



                                                      android:divider="@android:color/transparent"
                                                      android:dividerHeight="0dp"






                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Aug 7 '16 at 0:06









                                                      Peter Mortensen

                                                      13.3k1983111




                                                      13.3k1983111










                                                      answered Sep 16 '13 at 10:36









                                                      Zia

                                                      8401910




                                                      8401910






















                                                          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"





                                                          share|improve this answer



























                                                            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"





                                                            share|improve this answer

























                                                              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"





                                                              share|improve this answer














                                                              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"






                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Aug 7 '16 at 0:35









                                                              Peter Mortensen

                                                              13.3k1983111




                                                              13.3k1983111










                                                              answered Aug 27 '15 at 14:29









                                                              Fred

                                                              20435




                                                              20435






















                                                                  up vote
                                                                  4
                                                                  down vote













                                                                  For ListFragment use



                                                                  getListView().setDivider(null)


                                                                  after the list has been obtained.






                                                                  share|improve this answer

























                                                                    up vote
                                                                    4
                                                                    down vote













                                                                    For ListFragment use



                                                                    getListView().setDivider(null)


                                                                    after the list has been obtained.






                                                                    share|improve this answer























                                                                      up vote
                                                                      4
                                                                      down vote










                                                                      up vote
                                                                      4
                                                                      down vote









                                                                      For ListFragment use



                                                                      getListView().setDivider(null)


                                                                      after the list has been obtained.






                                                                      share|improve this answer












                                                                      For ListFragment use



                                                                      getListView().setDivider(null)


                                                                      after the list has been obtained.







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Apr 27 '14 at 11:42









                                                                      Meanman

                                                                      995148




                                                                      995148






















                                                                          up vote
                                                                          0
                                                                          down vote













                                                                          If this android:divider="@null" doesn't work, maybe changing your ListViews for Recycler Views? 






                                                                          share|improve this answer

























                                                                            up vote
                                                                            0
                                                                            down vote













                                                                            If this android:divider="@null" doesn't work, maybe changing your ListViews for Recycler Views? 






                                                                            share|improve this answer























                                                                              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? 






                                                                              share|improve this answer












                                                                              If this android:divider="@null" doesn't work, maybe changing your ListViews for Recycler Views? 







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Jun 9 '17 at 17:43









                                                                              Richard Nikolas

                                                                              1026




                                                                              1026






























                                                                                   

                                                                                  draft saved


                                                                                  draft discarded



















































                                                                                   


                                                                                  draft saved


                                                                                  draft discarded














                                                                                  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





















































                                                                                  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







                                                                                  Popular posts from this blog

                                                                                  Bressuire

                                                                                  Vorschmack

                                                                                  Quarantine