I'm trying to add a stikcy header to a listview. I've put the header-field and the listview inside a relativelayout and defined the listview's android:layout_below="@id/header".
The problem is that I want the listview and the header to be positioned at the same place when the listview is not scrolled to the top. The header's background is transparent. I drew an amazing image in paint to illustrate how I want them to interact.
I figured I could override the listviews onscrollistener and change the listvie开发者_如何转开发ws layout_below-tingy at runtime when it's getScrollY() == 0, but that seems to happen all the time.
Has anyone done something similar that could point me in the right direction?
you can try to call getFirstVisiblePosition
精彩评论