Android Navigation JetPack + BottomNavigationView + nested fragments

Viewed 1207

Do you have any example app that uses BottomNavigatationView with Navigation Component and includes nested fragment? I want to create an app with 3 tabs (A, B, C) in BottomNavigationView and each tab is related to fragment that containes nested fragment.

tab A: Frag A1 -> Frag A2 -> Frag A3, tab B: Frag B1 -> Frag B2, tab C: Frag C1 -> Frag C2.

Default implementation from Android Developers has some issues and doesn't work properly (according to BottomNavigationView material behavior):

  1. Clicking on active tab in bottom nav triggers recreating fragment (it should not do that).

  2. I select a tab (ex. tab B), move to nested fragment (ex. Frag B2), then select tab A and click again on tab B then Frag B1 is visible (not Frag B2 as I expected).

Do you have any solution for working that properly out of the box?

0 Answers
Related