Navigation View Global Action Back State

后端 未结 1 960
感动是毒
感动是毒 2021-01-21 05:13

I have been messing with the Jetpack Navigation component, and I created an activity that uses a navigation drawer.

class MainActivity : AppCompatActivity() {

          


        
相关标签:
1条回答
  • 2021-01-21 05:54

    As per the onNavDestinationSelected() documentation (which is how NavigationUI triggers menu items):

    By default, the back stack will be popped back to the navigation graph's start destination. Menu items that have android:menuCategory="secondary" will not pop the back stack.

    Therefore you can add android:menuCategory="secondary" to your menu item if you'd like to avoid popping other destinations off the stack when you select your settings destination.

    0 讨论(0)
提交回复
热议问题