Android Toolbar Adding Menu Items for different fragments

后端 未结 10 1678
野性不改
野性不改 2020-11-28 22:51

I have a toolbar as well as a navigation drawer. When I start my app, the toolbar and navigation drawer are created. When I click items in the navigation drawer, it starts n

10条回答
  •  不知归路
    2020-11-28 23:36

    Using new MaterialToolbar it's very easy to create an overflow menu and use to:

    
    

    and then in code to set OnCLick Listeners just add this:

    toolbar.setOnMenuItemClickListener {
                // .. DO SOMETHING HERE
                false
            }
    

提交回复
热议问题