Skip to content

header view should be invisible for top item (when the pinned header goes from an invisible to visible state) #7

@cliffsun91

Description

@cliffsun91

Hi, great little library btw, we've had some issues with the default android listviews and different height cells (some cells are header sections) with, which has caused bugs on some devices when using fastscroll (with certain datasets in the list). Your little POC library is great because its fits in with the new android design and also works great as all the cells are the same heights.

I've been trying to integrate your code into an application I am working on, however I noticed that there are a few small tweaks that are needed. The main one being that if you were to set the backgroundColor of the header views to transparent/null (comment out
'mAdapter.setPinnedHeaderBackgroundColor(pinnedHeaderBackgroundColor);' in MainActivity), you'll notice that when you scroll up so that the first item of an alphabetical section becomes 'pinned' (i.e. the pinned header view becomes visible in that locked position on the screen), you'll see the header view for the cell behind it still. Your sample app doesn't show this normally as you explicitly set the background colour for the header views, however if you have an app with a common background (which has a gradient for example), you'd want to allow the background of the header view to be transparent.

I suspect that all we would need to do is in PinnedHeaderListView.configureHeaderView(int position) in the PINNED_HEADER_VISIBLE state is find the first visible element of the list and make the header view in that invisible. Oppositely when the pinned header goes into the PINNED_HEADER_GONE state (which seems to only happen when scrolling up between the beginning of a section and the end of the previous section) we should then find the first visible element of the list and make the header view visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions