0

Not sure if I'm fighting an uphill battle but I'm currently struggling with AppBar, Fragments and Bottom Navigation Bars.

I have a MainActivity that's a list view with an AppBar. It's created as a fragment with the intention to add another bottom navigation bar here in the future.

For now, when an item in the list is clicked it navigates to a detail view fragment. Here I still have the AppBar which is what I want however I would like to add a Bottom Navigation Bar. However when I navigate to the next fragment I lose my bottom navigation bar.

Is there a way to keep maintain Bottom Navigation Bars within Fragments? I tried breaking them out into activities but discovered then I lose my AppBar.

Is what I'm doing above feasible in Android?

Ideally I'd like this:

enter image description here

jimgug
  • 165
  • 3
  • 10

1 Answers1

0

Do you have different nav graphs for different fragments? You need to have the detail view fragment in the same nav graph as the bottom navigation view. You don't need to have another item in bottom navigation but declare fragments that you want with bottom navigation in the same nav graph.

Arsh
  • 279
  • 2
  • 6
  • Yes I have two nav graphs. The idea is to evolve the app to have two separate bottom navigation views for each of those screens above. – jimgug Oct 20 '22 at 13:48
  • please share your nav graphs so that I can help. Also clearing how your app is designed will help me out – Arsh Oct 21 '22 at 02:17
  • Do you have completely different items in both the bottom navigation views? – Arsh Oct 21 '22 at 02:28