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 hide action bar (or Tab bar) while scrolling the list #88

Open
Rajansm opened this issue Jan 1, 2016 · 1 comment
Open

how to hide action bar (or Tab bar) while scrolling the list #88

Rajansm opened this issue Jan 1, 2016 · 1 comment

Comments

@Rajansm
Copy link

Rajansm commented Jan 1, 2016

I am showing list of items in the fragment. The fragment is setup using this library.
I want to hide the action bar (or Tab bar) when User scrolls down the list, just to have more space on screen.

any idea how can I achieve this?

@LOG-TAG
Copy link

LOG-TAG commented Aug 2, 2016

 AppBarLayout.LayoutParams params =
                (AppBarLayout.LayoutParams)   this.getToolbar().getLayoutParams();

        params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
                | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);

this is the programmatic way but fails ending up error!!

java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.AppBarLayout$LayoutParams

This is because of android.support.design.widget.AppBarLayout placed with LinearLayout as a parent for Toolbar in this Library !!!

Required

<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/navigation_drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.CoordinatorLayout
       .
        .

        <android.support.design.widget.AppBarLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_scrollFlags="scroll|enterAlways" />

        </android.support.design.widget.AppBarLayout>

        .
        .

</android.support.v4.widget.DrawerLayout>

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

2 participants