android hide / show Toolbar does not fill the space bottom -


to make scrolling animation background not filled, doing wrong?

i using - drawerlayout - v7 toolbar - pager - swiperefreshlayout - recyclerview

activity

<linearlayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <include         android:id="@+id/toolbar"         layout="@layout/toolbar" />      <framelayout         android:id="@+id/container"         android:layout_width="match_parent"         android:layout_height="match_parent"></framelayout> 

fragment pager container

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">  <com.squidit.squid.ui.widget.slidingtablayout     android:id="@+id/tabs"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:elevation="2dp"     android:background="@color/primarycolor"/>  <android.support.v4.view.viewpager     android:id="@+id/pager"     android:layout_width="match_parent"     android:layout_height="match_parent" /> 

fragment content

<android.support.v4.widget.swiperefreshlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/missionswiperefresh" android:layout_width="match_parent" android:layout_height="match_parent" >  <android.support.v7.widget.recyclerview     android:id="@+id/recyclerview"     android:layout_width="match_parent"     android:layout_height="match_parent"             /> 

scroll hide

private void hideviews() {     mtoolbar.animate().translationy(-mtoolbar.getheight()).setinterpolator(new decelerateinterpolator(2));     container.animate().translationy(-mtoolbar.getheight()).setinterpolator(new decelerateinterpolator(2)).start();         } 

problem:

container rises top, space occupied on bottom without filling

ilustration:

https://drive.google.com/open?id=0b-vxv0qpz2dqcwp5edvrbmd3czq&authuser=0

i had same problem. after hiding toolbar , status bar layout looks http://i62.tinypic.com/qowvgi.png.

edit: may noticed translation not same moving view out. resize layout animation set layoutparams.height on desired inside valueanimator.

mtoolbar = (toolbar) getactivity().findviewbyid(r.id.toolbar);     toolbarheight = mtoolbar.getheight(); 

and finally

valueanimator anim = valueanimator.ofint(toolbarheight, 0);     anim.setduration(1000);     anim.addupdatelistener(new valueanimator.animatorupdatelistener() {         @override         public void onanimationupdate(valueanimator animation) {             integer value = (integer) animation.getanimatedvalue();             mtoolbar.getlayoutparams().height = value.intvalue();             mtoolbar.requestlayout();          }     });     anim.start(); 

the code above hides toolbar affecting main layout expand itself. idea given that question.

also make sure using fitssystemwindows in layout resize.

android:fitssystemwindows = "true" 

Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

css - SVG using textPath a symbol not rendering in Firefox -

order - Notification for user in user account opencart -