Add a ListView or RecyclerView to new NavigationView

前端 未结 4 868
星月不相逢
星月不相逢 2020-12-05 08:10

I am using the new NavigationView from revision 22.2.0 of the support library by Google. It works perfectly fine to generate a navigation drawer populated using a menu res.<

4条回答
  •  眼角桃花
    2020-12-05 08:25

    You can just nest the ListView or RecyclerView inside the NavigationView.

    
    
    
    
        
    
            
    
        
    
        
    
            
    
    

    NOTE: Keep in mind that if you use use a ListView inside it, you can't use the NavigationView's header. You will have to use the header view of the ListView that you are adding. Don't forget to remove the app:menu and app:header fields.

提交回复
热议问题