Blogs/Technology

Instagram-like Bottom tab Fragment Transaction Android

Written by Murtuza Kutub
Mar 23, 2026
3 Min Read
Instagram-like Bottom tab Fragment Transaction Android Hero
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.

What inspired me to write this post?

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.

Is that hard to implement sticky Bottom tabs with Fragments transactions in all the screens?

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.

Fragments
  1. Tap on “CLICK ME” button.
  2. Can you see that Toolbar text has changed from “Home” to “Sub Home 1” and so on till “Sub Home 4” by clicking it four times? Yes! It does!, all these Sub Home 1 ….. Sub Home 4 are nested fragments inside Home (Main Fragment) . Ideally, new fragments are pushed and replaced with one after the other with successive clicks. Yup! Bottom bars are always fixed too.
  3. Now navigate to another tab, come back again and check the behaviour in “Home” tab. The state is maintained with the same screen where you left (Sub Home 4, 4th fragment) :)
  4. Finally, click back button and experience the behaviour that previous fragments are popped in automatically without losing the previous states. Yeah! This works even with back soft key.
Home Fragments

Why TabLayout instead of Design support BottomNavigationView?

Infographic titled “Why TabLayout Instead of BottomNavigationView” highlighting limited customization options, inconsistent behavior with fewer tabs, and difficulty scaling text and icons in BottomNavigationView.

Choosing the right component impacts flexibility and control.

Automate Your Android Workflow

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.

FAQ

Why are fragment transactions complex in Android?

Fragment transactions involve lifecycle handling, backstack management, and UI state preservation, making them harder to implement correctly.

What is the benefit of sticky bottom tabs?

Sticky bottom tabs maintain state across screens, improving user experience by preserving navigation context.

Automate Your Android Workflow

We build Android Studio plugins that cut manual effort, improve speed, and make your development process seamless.

Why use TabLayout instead of BottomNavigationView?

TabLayout offers more flexibility in customization, layout control, and handling complex navigation flows.

What are nested fragment transactions?

Nested fragment transactions allow fragments within fragments, enabling deeper navigation without losing parent state.

How do you maintain fragment state across tabs?

By managing fragment backstacks and avoiding unnecessary replacements, the state can be preserved when switching tabs.

Author-Murtuza Kutub
Murtuza Kutub

A product development and growth expert, helping founders and startups build and grow their products at lightning speed with a track record of success. Apart from work, I love to Network & Travel.

Share this article

Phone

Next for you

8 Best GraphQL Libraries for Node.js in 2025 Cover

Technology

Jan 29, 20268 min read

8 Best GraphQL Libraries for Node.js in 2025

Why do some GraphQL APIs respond in milliseconds while others take seconds? The difference often comes down to choosing the right GraphQL library for Node.js. According to npm trends, Apollo Server Express alone sees over 800,000 weekly downloads, proving that developers need reliable tools to build production-ready GraphQL servers. The truth is, building GraphQL APIs in Node.js has never been easier, but picking the wrong library can slow down your entire application. Modern web applications d

I Tested 9 React Native Animation Libraries (Here’s What Works) Cover

Technology

Feb 10, 202614 min read

I Tested 9 React Native Animation Libraries (Here’s What Works)

Why do some mobile apps feel smooth while others feel clunky? I’ve noticed the difference is usually animations under load, especially during scrolling, navigation, and gesture-heavy screens. Google research shows 53% of mobile site visits are abandoned if pages take longer than three seconds to load, and the same performance expectations carry over to mobile apps. The truth is, smooth animations in React Native apps are no longer a luxury; they’re a must-have for a modern, engaging user experi

9 Critical Practices for Secure Web Application Development Cover

Technology

Jan 29, 20267 min read

9 Critical Practices for Secure Web Application Development

In 2026, developing modern web applications requires a balance between speed and security. Product strategy often pressures development teams to move fast, and ignoring application security can cause catastrophic results. For example, post-credential-based attacks have caused over $5 billion in losses. Security vulnerabilities in web applications are not just technical security problems; they are a business risk. The truth is that security incidents happen when web developers think about web se