Search code examples
androidkotlinandroid-fragmentsandroid-actionbarandroid-architecture-navigation

How to hide the default fragment actionBar create our own actionBar in android & kotlin


I have an android app with bottom navigation containing 3 fragments and all have their own actionBar by default. I want to hide all the default actionBar of three fragments and create my own actionbar with many options. I am using Kotlin.


Solution

  • I have solved the problem.

    val appBarConfiguration = AppBarConfiguration(setOf( R.id.navigation_home, R.id.navigation_messages, R.id.navigation_profile)) 
    setupActionBarWithNavController(navController, appBarConfiguration)
    

    Just remove the above two lines from the main activity and your problem is solved.