Snackbar is hidden behind RecylerView if there are enough items to allow to for scrolling
Opened this issue · 6 comments
I’m using the snackbar to notify when an item has been deleted from the recyclerview list. I’m using: https://github.com/krossovochkin/Android-SwipeToDismiss-RecyclerView
My snackbar displays fine if there are too few items for the recyclerview to scroll, but once the list is surpasses the height of the screen, the snackbar is hidden behind the recyclerview.
In the image, I’ve just started swiping at the bottom of the screen, and I can see the snackbar appear.
This is in 5.0.
Can you post the code you are using to display the snackbar?
I've got this issue in our application too, and after much experimentation I got a test app that shows the problem: https://github.com/jonathan-caryl/SnackbarIssue109.
It looks like it's happening when the android.support.v4.widget.DrawerLayout is given an elevation, which means it's getting drawn over the Snackbar.
It's worth noting that the problem doesn't show up when you run on a pre-Lollipop version of Android, where Views have no elevation.
I've made a PR with a fix in, I hope it's suitable.
Solution (Which Worked for me):
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinatorLayout">
<android.support.v7.widget.RecyclerView
android:id="@+id/myRecyclerView"
android:background="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.design.widget.CoordinatorLayout>
ADD 'RecyclerView' INSIDE CoordinatorLayout AND USE THAT 'CoordinatorLayout' AS VIEWING YOUR SNACKBAR - PROBLEM SOLVED. :)