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

downscroll in appbarlayout #217

Open
vishal044 opened this issue Jan 12, 2018 · 3 comments
Open

downscroll in appbarlayout #217

vishal044 opened this issue Jan 12, 2018 · 3 comments

Comments

@vishal044
Copy link

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>

`

@vishal044
Copy link
Author

hey. fixed the issue . xD

had to add custom class extending AppbarLayout.behavior .

@karasekkarolina
Copy link

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

@henrytao-me
Copy link
Owner

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.

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

3 participants