henrytao-me/smooth-app-bar-layout

downscroll in appbarlayout

vishal044 opened this issue · 3 comments

Hi,
i made collapsable layout, put frame in it and recycler below it.
scrolling it up to collapse the frame is fine, but scrolling down isnt smooth. kindly help.

`

<EditText

    android:id="@+id/location_id"
    android:hint="Enter location"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textPersonName"
    android:text="chandigarh" />

<Button
    android:id="@+id/loc_button"
    android:textSize="10sp"
    android:text="Enter"
    android:textStyle="italic"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>


<android.support.design.widget.CoordinatorLayout
    android:id="@+id/coordinate"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbarlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <FrameLayout
                android:id="@+id/frame"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                app:layout_collapseMode="parallax"
                ></FrameLayout>

            <!--<android.support.v7.widget.Toolbar-->
                <!--android:layout_width="match_parent"-->
                <!--android:layout_height="wrap_content"-->
                <!--app:layout_collapseMode="pin"></android.support.v7.widget.Toolbar>-->

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

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycle"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

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

`

hey. fixed the issue . xD

had to add custom class extending AppbarLayout.behavior .

Hi, I think I've got the same problem. Any hint how to set AppbarLayout.behaivour correctly? Thank for answer.

Hi @vishal044 @klepackovakarolina, there are few things you can try:

  • CoordinatorLayout height needs to be match_parent or 0dp with layout_weight=1
  • Instead of using android:layout_marginTop="20dp", using android:layout_paddingTop="20dp"
  • Placing RecyclerView before or after AppBarLayout is not matter.