
Have you ever struggled with fragment transactions behaving unpredictably? I’ve noticed this becomes especially challenging when managing backstacks and maintaining UI state across screens.Fragments are powerful, but not straightforward. Handling add, replace, and backstack behavior often introduces complexity that affects navigation flow and user experience.
The inspiration comes from Instagram’s navigation experience. It is simple, responsive, and minimises unnecessary screen transitions.
The bottom tab navigation pattern has become widely adopted because it keeps core actions accessible while maintaining state across screens.
This article focuses on replicating that behaviour using fragments with controlled transactions.
Yes, it can be challenging without a structured approach.
In this article, the goal is to implement bottom tabs using fragments with nested fragment transactions while preserving state across tabs.
This setup ensures smooth navigation without losing context, which is critical for user experience.
Yeah! Here if you see the above Gif, there are five tabs like Home, Search, Share, News and Profile. Selecting each tab options, respective Fragments are pushed. That’s obvious isn’t? Cool! If you notice keenly, I have assigned “CLICK ME” button for Home and News Fragments to showcase the behaviour of Nested Fragments Transactions inside same Fragments without losing its state. Let’s do it in a linear way.



Choosing the right component impacts flexibility and control.
We build Android Studio plugins that cut manual effort, improve speed, and make your development process seamless.
BottomNavigationView has limitations in customization and behavior consistency. It lacks flexibility when dealing with varying tab counts and custom UI requirements.
Customizing text sizes and icon scaling can become restrictive, especially when handling different visual states across tabs.
TabLayout provides better control over layout behavior, styling, and interaction, making it more suitable for implementing complex navigation patterns like this.
Fragment transactions involve lifecycle handling, backstack management, and UI state preservation, making them harder to implement correctly.
Sticky bottom tabs maintain state across screens, improving user experience by preserving navigation context.
We build Android Studio plugins that cut manual effort, improve speed, and make your development process seamless.
TabLayout offers more flexibility in customization, layout control, and handling complex navigation flows.
Nested fragment transactions allow fragments within fragments, enabling deeper navigation without losing parent state.
By managing fragment backstacks and avoiding unnecessary replacements, the state can be preserved when switching tabs.