Show or hide ActionBar when scrolling webview

In my solution, I use Android-ObservableScrollView library. You can find this library at this link

  1. Add library to your project:
    compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
  2. Add ObservableScrollView to layout:
  3. Add ObservableScrollViewCallbacks to activity:
    this.contentWebView.setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
                public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
                public void onDownMotionEvent() {
                public void onUpOrCancelMotionEvent(ScrollState scrollState) {
                    if (scrollState == ScrollState.UP) {
                        // hide your action bar
                    } else if (scrollState == ScrollState.DOWN) {
                        // show your action bar

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s