android - Toolbar does not respond to scroll flags -


i trying hide toolbar when listview scrolling tabs remain visible reason cannot.

code:

private void setuppages() {         toolbar = (toolbar) findviewbyid(r.id.toolbar);         if (build.version.sdk_int >= build.version_codes.lollipop) {             if (toolbar != null) {                 toolbar.setelevation(0);             }         }         viewpager = (viewpager) findviewbyid(r.id.pager);         intent = getintent();         servitoros_id = intent.getstringextra(appconstant.waiter_intent_id);         magazi_id = intent.getstringextra(appconstant.company_intent_id);         title = intent.getstringextra(appconstant.table_intent_id);         if (toolbar != null) {             toolbar.settitle(getstring(r.string.table_id) + title);         }         madapter = new productstabpageradapter(getsupportfragmentmanager(), productsvieworder.this, productsvieworder.this);         viewpager.setadapter(madapter);         tabs = (tablayout) findviewbyid(r.id.tabs);         tabs.setupwithviewpager(viewpager);         tabs.setselectedtabindicatorheight(6);         tabs.setselectedtabindicatorcolor(getresources().getcolor(r.color.white));         if (toolbar !=null){             setsupportactionbar(toolbar);         }          coffeeslist = new arraylist<>();         snackslist = new arraylist<>();         sweetslist = new arraylist<>();         if (toolbar != null) {             toolbar.setonmenuitemclicklistener(new toolbar.onmenuitemclicklistener() {                 @override                 public boolean onmenuitemclick(menuitem item) {                     int id = item.getitemid();                     switch (id) {                         case r.id.search: {                             showsearchresults();                             break;                         }                         case r.id.cart: {                             showcart();                             break;                         }                     }                      return true;                 }             });         }     } 

xml file:

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:background="@color/white">  <android.support.design.widget.appbarlayout     android:layout_width="match_parent"     android:fitssystemwindows="true"     android:layout_height="wrap_content">      <android.support.v7.widget.toolbar         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         app:popuptheme="@style/themeoverlay.appcompat.light"         android:id="@+id/toolbar"         app:layout_scrollflags="scroll|enteralways|snap"         android:background="@color/btn_login">     </android.support.v7.widget.toolbar>      <com.quinny898.library.persistentsearch.searchbox         android:id="@+id/searchbox"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="-6dp"         android:layout_marginright="-6dp"         android:layout_margintop="-66dp"         android:background="@color/btn_login"         android:visibility="gone" />      <android.support.design.widget.tablayout         android:id="@+id/tabs"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/btn_login" /> </android.support.design.widget.appbarlayout>      <android.support.v4.view.viewpager         android:id="@+id/pager"         android:layout_width="match_parent"         android:layout_height="match_parent"         app:layout_behavior="@string/appbar_scrolling_view_behavior"/>  </android.support.design.widget.coordinatorlayout> 

my gradle dependencies:

dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     compile files('libs/circularimageview.jar')     compile 'com.android.support:appcompat-v7:23.1.0'     compile 'com.android.support:support-v4:23.1.0'     compile 'com.quinny898.library.persistentsearch:library:1.0.0-snapshot'     compile 'com.android.support:design:23.1.0' } 

any highly appreciated. followed this tutorial in order this.

use observablescrollview purpose, cleanest , nicest way this. https://github.com/ksoichiro/android-observablescrollview


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -