android - Make Header View (not Section Header) of ListView Stick on Top -
i have listview headerview.
i want 1 of views in headerview
stick on top.
i've seen lot of examples sticky section headers.
i looked @ stickyscrollviewitems since i'm using listview
, cannot use scrollview
.
is there library available or should override onscrolllistener
of listview
?
thanks.
i have written load of code cant share contractoral reasons. follow approach outlined here , apply listview rather scroll view.
main points are
- create wrapper view contains floating/sticky header , listview siblings
- use proxy method when adding headers issticky boolean - if sticky add fake blank header listview of same size , intended header view floating header wrapper (use relative layout here)
- set scroll listener of listview tracks top px position of dummy header view in list , setting top margin of floating header sits inside relative layout
- handle annoying edge cases / oem overscroll crap work in situtions (like this samsung)
remember set initial position of floating/pinned header after listview has been layed out.
i feel little bit involved , takes tweaking right - time envy ios , ios devs think slacking takes while implement :d
all open libs out there @ time of writing using scroll views or list view headers. issue these approaches list views recycle views (so unlike scroll views cant keep ref dummy view) , current libs seem duplicate sticky views using adapter getview
methods , on - no dynamic list view header views not recycled , can have 1 parent, reparenting annoying (and in case has lot of functionality defo dont want create 2 views of same type , shoehorn current libs fit solutions)
Comments
Post a Comment