0

I have a RecycleView in my fragment, and I need to show a snackbar at the bottom of it. Whenever I pass the RecycleView to the snackbar's view parameter, it just shows the snackbar at the bottom of the fragment (I have stuff below the RecycleView that is getting covered up by the fragment).

This is the code I'm using:

Snackbar.make(mRecyclerView, "New message!", Snackbar.LENGTH_LONG).show();

What should I pass as the first parameter to make the snackbar appear in the correct location?

CaptainForge
  • 1,365
  • 7
  • 21
  • 46
  • Snackbars traverse the View hierarchy up either a CoordinatorLayout or the window's decor view so it shows at the bottom of the screen (not the fragment). You can't pin it to the bottom of a RecyclerView. – DeeV Jun 30 '16 at 19:24
  • 1
    Actually now that I think about it, if you wrap your RecyclerView inside a Coordinatorlayout, then should appear at the bottom of the View. – DeeV Jun 30 '16 at 19:25

1 Answers1

1

@DeeV solved my problem: Wrap the RecyclerView inside a CoordinatorLayout.

CaptainForge
  • 1,365
  • 7
  • 21
  • 46