0

I am trying to call snack bar in dialog fragment. But it shows on top of system buttons. To avoid this I need to call findViewById(android.R.id.content) in snack bar call. But not sure how to make it correct way.

In parent fragment I am calling this way

        Snackbar.make(requireActivity().findViewById(android.R.id.content), "fdfdfdf", Snackbar.LENGTH_LONG).show();

and it works perfectly but the problem is that dialogfragment is on top of the snack bar so its not visible. So I need to call it from dialog fragment. But when I call it from dialog snack bar not visible.

Bob Redity
  • 529
  • 5
  • 14
  • [This](https://stackoverflow.com/a/38851714/9851608) probably answers your question – Zain Jun 23 '22 at 16:00

1 Answers1

0

Make your dialog layout fullscreen with transparent background and keep your dialog content inside it and then while showing the snackBar give rootview of the dialog layout.

[Source: https://stackoverflow.com/a/51150711/11831226]

Dr.jacky
  • 3,341
  • 6
  • 53
  • 91
Hossein Asadi
  • 768
  • 1
  • 6
  • 15
  • is there a code sample? Btw my dialog is match parent with the view inside it which is not transparent will it be a problem? – Bob Redity Jun 23 '22 at 15:56