Skip to content

Instantly share code, notes, and snippets.

@vincent-paing
Created October 1, 2016 09:27
Show Gist options
  • Save vincent-paing/e257cfedef2d1a28f13db2d3e62b1663 to your computer and use it in GitHub Desktop.
Save vincent-paing/e257cfedef2d1a28f13db2d3e62b1663 to your computer and use it in GitHub Desktop.
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
boolean isShow = false;
int scrollRange = -1;
@Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (scrollRange == -1) {
scrollRange = appBarLayout.getTotalScrollRange();
}
if (scrollRange + verticalOffset == 0) {
getSupportActionBar().setTitle(series.title_english);
isShow = true;
} else if (isShow) {
getSupportActionBar().setTitle("");
isShow = false;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment