-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draw divider for list header/footer views #268
base: master
Are you sure you want to change the base?
Conversation
I'll look through the code later today but in the mean time it would be great to implement |
The return value of |
It turns out the bug I described in the previous comment, which I just deleted, was not relevant to the changes from this pull request. I've made a separate PR(#270) to deal with the issue. |
@@ -123,6 +123,7 @@ public StickyListHeadersListView(Context context, AttributeSet attrs, int defSty | |||
mDividerHeight = mList.getDividerHeight(); | |||
mList.setDivider(null); | |||
mList.setDividerHeight(0); | |||
mList.setListDivider(mDivider, mDividerHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very confusing as it looks like the two above line of code are useless even though they aren't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because mDivider
and mDividerHeight
must be passed to mList
, those three set*Divider*()
s will be there anyway. I'd love to make it less confusing, yet nothing came up in my mind for now.
Sorry for the delay but i haven't had any time to look over fixing some of the issues i have with the code. |
+1 Why has this not been merged? |
+1 |
Dividers for header/footer view is drawn in
ListView
by default. I made a patch to imitate this drawing using pattern already being used in the library; making use ofWrapperView
. Header/footer view is now wrapped byWrapperView
and managed with a little more care.WrapperViewList.java:112-121
As each divider in
WrapperView
is drawn by the view below, the last divider at the bottom has to be drawn differently. (fyi: divider at the bottom is only shown when items of theListView
doesn't fill all theListView
's space. Refer to the screenshots in this SO question)Further improvement would be to implement
android:header(footer)dividersenabled
, giving on/off functionality.If you would merge please review the code throughly. Though I tested several cases I may have not caught all the edge cases. I'd be glad to take any feedback.