nispok / snackbar

[DEPRECATED] Android Library that implements Snackbars from Google's Material Design documentation.
MIT License
1.53k stars 238 forks source link

Snackbar is hidden behind RecylerView if there are enough items to allow to for scrolling #109

Open perpetuatingcuriosity opened 9 years ago

perpetuatingcuriosity commented 9 years ago

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.

screenshot_2015-04-15-17-20-53

perpetuatingcuriosity commented 9 years ago

This is in 5.0.

fahimk commented 9 years ago

Can you post the code you are using to display the snackbar?

jonathan-caryl commented 9 years ago

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.

jonathan-caryl commented 9 years ago

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.

jonathan-caryl commented 9 years ago

I've made a PR with a fix in, I hope it's suitable.

keyur2111 commented 5 years ago

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. :)