Creating a navigation drawer over action bar with header

前端 未结 1 1526
南笙
南笙 2021-01-23 14:35

I have a translation app that helps people to learn a language and play games to check their learning. The app already has a navigation drawer but it appears under the action ba

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 15:39

    I would use the new Toolbar instead of ActionBar. Checkout this tutorial: http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html

    The important part is that you have to put the toolbar inside the DrawerLayout as seen here (activity_main.xml):

    
    
    
        
    
            
            
    
            
    
        
    
        
    
        
    
    
    

    toolbar.xml:

    
    
    
    

    To use the toolbar:

    Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    setSupportActionBar(toolbar);
    

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