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

Can't show AppBarLayout upon scrolling up #4

Open
vladraduvidican opened this issue Apr 13, 2020 · 4 comments
Open

Can't show AppBarLayout upon scrolling up #4

vladraduvidican opened this issue Apr 13, 2020 · 4 comments

Comments

@vladraduvidican
Copy link

vladraduvidican commented Apr 13, 2020

Issue 1.:

This is my layout:

    <LinearLayout>
        <androidx.coordinatorlayout.widget.CoordinatorLayout>




            <com.google.android.material.appbar.AppBarLayout>
                <androidx.constraintlayout.widget.ConstraintLayout>
                                    --- APPBARLAYOUT CONTENT ---
                </androidx.constraintlayout.widget.ConstraintLayout>
            </com.google.android.material.appbar.AppBarLayout>



            <FrameLayout>
                <uz.jamshid.library.IGRefreshLayout>

                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/recycler_list" />

                </uz.jamshid.library.IGRefreshLayout>
            </FrameLayout>




        </androidx.coordinatorlayout.widget.CoordinatorLayout>
    </LinearLayout>

The appbarlayout scrolls with these flags: app:layout_scrollFlags="scroll|snap|exitUntilCollapsed.
The IGRefreshLayout overrides this scroll, and instead triggers the refresh animation, without letting the appbarlayout show itself first. Scrolling a bit down, and then up again fixes this issue.

Issue 2.:
The same layout, but with the IGRefreshLayout as the top element has this same effect + when scrolling up, the views from the recyclerlayout are not recycled, and the IGRefreshLayout animation triggers again.

@Jamshid-M
Copy link
Owner

Hello
For your first issue just add app:layout_behavior="@string/appbar_scrolling_view_behavior" into FrameLayout which covers RefreshLayout

@Jamshid-M
Copy link
Owner

For second issue the only way to fix this issue with appbar is to set listener for AppBarLayout

appBar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
//swip is IGRefreshLayout instance
swipe.isEnabled = verticalOffset == 0
})

Case with Coordinator and AppBarLayout not implemented yet

@vladraduvidican
Copy link
Author

Unfortunately for the second case the refresh layout scrolls up and remains there, in the disabled state without ever coming back down

@Jamshid-M
Copy link
Owner

Everything works as a charm in my device, maybe you miss something, here is my code
image
image

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