android – Resize AbsListView with an animation

I have a problem with expanding a listview to parent height. My scene starts with listview and toolbar.

scene

When listview is swiped i am moving the toolbar and listview to the top. I want listview to fill the whole scene at this moment, but i am getting the following result:

scene

scene Layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"       
    xmlns:tools="http://schemas.android.com/tools"      
    xmlns:app="http://schemas.android.com/apk/res-auto"     
    android:layout_width="match_parent"    
    android:layout_height="match_parent"      
    tools:context=".MainActivity">        

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"       
        android:id="@+id/my_toolbar"          
        android:layout_width="match_parent"                         
        android:layout_height="wrap_content"        
        android:background="@color/colorPrimary" />          

    <ListView
        android:id="@+id/cardContainer"
        android:layout_width="fill_parent"             
        android:layout_height="fill_parent"
        android:layout_below="@id/my_toolbar"/>


    <com.melnykov.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_marginRight="16dp"                   
        android:layout_marginBottom="20dp"
        app:fab_shadow="false"
        app:fab_type="normal"                   
        android:src="http://stackoverflow.com/@drawable/add" />                                 

</RelativeLayout>                    

moving methods:

private void hideToolbar() {
        toolbarView.animate().translationY(-toolbarView.getBottom()).alpha(0).setDuration(320).setInterpolator(new DecelerateInterpolator());
        cardContainer.animate().translationY(-toolbarView.getBottom()).setDuration(320).setInterpolator(new DecelerateInterpolator());
        shown = false;
}

private void showToolbar() {
    toolbarView.animate().translationY(0).alpha(1).setDuration(400).setInterpolator(new DecelerateInterpolator());
    cardContainer.animate().translationY(0).setDuration(400).setInterpolator(new DecelerateInterpolator());
    shown = true;
}

Loading...

(Visited 6 times, 1 visits today)