N
N
ngapp2022-03-24 15:57:00
Apache HTTP Server
ngapp, 2022-03-24 15:57:00

How to override one item per bottomNavView in Android?

Hello everyone, in android studio there are standard Google templates with Navigation Drawer and a template with Bottom Navigation. Combining them, you get an architecture when MainActivity drives all navigation through nav_graph.
How in this case it is possible to redefine only one item in the bottomNavView, so that when you click on it, the NavigationDrawer opens?
623c699406ada256311889.png
The problem is that using bottomNavView.setOnItemSelectedListener overrides all buttons at once, which is technically impossible.
You can't switch from MainActivity to another fragment using Directions because it's not a host fragment, and you can't use MainActivityDirections from an activity.

bottomNavView.setOnItemSelectedListener { item ->
            when (item.itemId) {
                R.id.nav_menu -> {
                    binding.drawerLayout.openDrawer(Gravity.LEFT)
                }
                R.id.nav_map -> {
                    navController.navigate(MainActivityDirections.action...)
                    [email protected] false
                }
                R.id.nav_favourites -> {
                    navController.navigate(MainActivityDirections.action...)
                    [email protected] false
                }
                R.id.nav_home -> {
                    navController.navigate(MainActivityDirections.action...)
                    [email protected] false
                }
            }
            [email protected] false
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2016-07-05
@kascor

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)\.html$ /index.php?page=$1 [END,QSA]
RewriteRule ^([^/]*)$ /index.php?page=$1 [END]

I
IceJOKER, 2016-07-04
@IceJOKER

RewriteEngine on
RewriteRule ^test(.html)? /index.php?page=test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question