Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show toolbar when ScrollState to the top? #123

Open
ghost opened this issue Feb 1, 2017 · 0 comments
Open

How to show toolbar when ScrollState to the top? #123

ghost opened this issue Feb 1, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 1, 2017

When I Scroll UP, toolbar is hide. When I Scroll DOWN, it shows toolbar . But when I Scroll DOWN, I want to show toolbar (ScrollState to the top). It have ScrollState.STOP. I thinks to check condition. `implements ObservableScrollViewCallbacks`

toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
scrollView = (ObservableScrollView) findViewById(R.id.scroll);
scrollView.setScrollViewCallbacks(this);

@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {

}

@Override
public void onDownMotionEvent() {

}

@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants