开发者

Any way of knowing when a listview has scrolled to top?

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.

Any way of knowing when a listview has scrolled to top?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜