Skip to content

Instantly share code, notes, and snippets.

@goodev
Created November 27, 2013 05:54
Show Gist options
  • Save goodev/7671261 to your computer and use it in GitHub Desktop.
Save goodev/7671261 to your computer and use it in GitHub Desktop.
移动 header view
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int scrollY = getScrollY();
//sticky actionbar
mHeader.setTranslationY(Math.max(-scrollY, mMinHeaderTranslation));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment