How to remove the bottom divider of the footer in an android listview
Asked Answered
B

2

15

As simple as that. Of course using android:footerDividersEnabled="false" wont work on this one, cause it will remove both upper and bottom dividers.

I made this question yesterday, can't remember who tried to answer it but i had to erase it cause a troll started downgrading the question cause it was "unclear" (if you don't know what is a divider or a footer, or bottom, or what is android, yes it can be...)

Anyway if that was the case let's picture a 2 items listview and i want to give a space with a footer, but without the footer showing the bottom line that corresponds to the bottom divider, but keeping the other dividers, also, have in mind that is just how to remove that, i can make a hack to use 2xviews and use the even as dividers as suggested, but for me that doesn't make sense, it would be more efficient just to add an extra empty view + footer of 1px + the footerDividersEnabled as i'm doing now, but that is just a plain hack, and it is becoming unmanagable. Also adding a line to the top of the Layout of the footer won't work cause you will have a space when the listView items contains color or similars on their background, because you will see the background color where the divider was supposed to be.

There's no way to specify android to don't show the bottom divider of the footer?

Please try to understand that this is not the same question as:

Remove the bottom divider of an android ListView

Before going troll without reading and downgrading.

@Kor lets say that the footer looks like these normally:
CASE 1:


ListItemN


Footer




Using the android:footerDividersEnabled="false" looks like this:
CASE 2:


ListItemN

Footer


And i want a way to have it like this:
CASE 3:


ListItemN


Footer



But only have found the hacky ways described above. I hope this helps, if it doesn't let me know what else do you need.

Bilski answered 8/8, 2012 at 14:1 Comment(5)
@Bilski please, bear in mind that we're here to help you, only if you are willing to collaborate. In my opinion, this visual hacks tend to be selfexplanatory with a couple of pictures of what you are trying to achieve, and what you are currently doing. They don't need to be very well drawn, just enough to understand what's going on. You can have a look at a picture I added to a question I posted. It's fairly simple, yet easy to understand. PS: Being rude or feeling nervous won't help anyone of us.Sherise
@Kor i edited the question to include your suggestion.Bilski
good to know. This truly clarifies (at least) me your goals. I am not used to use footers or headers in listviews, but maybe a simple styling for your footer could do the trick. Set android:footerDividersEnabled="false" and then style your custom footer view with a top border. But hey, I'm just talking for the sake of it, don't take mine as an answer, because I cannot give it a try right now to check if it works.Sherise
Yeah, that may do the trick, but it would be another hack, that is what i don't want, not sure what issues can bring this in the future. OFC this does the trick and is by far better than what i'm using... But asking again "There's no way to specify android to don't show the bottom divider of the footer?, or to remove the bottom divider of the footer in an android listview" it has to be done via hack?Bilski
@dnkoutso "Also adding a line to the top of the Layout of the footer won't work cause you will have a space when the listView items contains color or similars on their background, because you will see the background color where the divider was supposed to be." Please read the question and the reason this don't work. I was not asking for a magic flag, but a serious solution of a real problem, because the hacks don't work in all the scenarios. Don't be rude please.Bilski
A
10

Just use this to avoid divider lines of list view android:footerDividersEnabled="false"

  <ListView
                android:id="@+id/listHomeListViewController"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/ImageView01"
                android:cacheColorHint="@android:color/transparent"
                android:footerDividersEnabled="false" >
            </ListView>

//vKj

Adjure answered 11/12, 2013 at 4:28 Comment(3)
Very late but this is wrong. This will remove the divider BEFORE the footer as well.Iconolatry
Instead as noted elsewhere use android:height="wrap_content" on your ListViewIconolatry
What the actual f*ck, android:height="wrap_content" WORKED... But WHY?!?!?!? omgStockman
P
2

You have to use a hack. What you are trying to achieve something that goes against the regular behavior.

The simplest solution has already been described by @Kor. Simply make the row layout with a top header.

Plastid answered 22/8, 2012 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.