Jumpa
Jumpa

Reputation: 4419

Navigation Component with ContextMenu

I've a MainActivity linked with navigation component. Every fragment has its own implementation of Toolbar and I setup it, calling this method defined in the activity, from the specific fragment:

fun setupToolbar(toolbar: Toolbar) {
        setSupportActionBar(toolbar)
        supportActionBar?.setDisplayShowTitleEnabled(false)
        NavigationUI.setupActionBarWithNavController(this, navController)
        setupActionBarWithNavController(navController)
    }

Now, this is working great, except that now I need to add a context menu (beside the classic options menu) to delete an item of a list. When I long-press a view, this is the result:

Toolbar duplicated

How can I avoid this duplicate? Why the context menu is not honoring the toolbar I setup earlier?

Upvotes: 1

Views: 29

Answers (0)

Related Questions