Two Navigation Drawer on same Activity

前端 未结 4 2167
盖世英雄少女心
盖世英雄少女心 2020-12-01 17:22

Is it possible to configurate two Navigation Drawers on the same activity, one from the left and the other from the right?

4条回答
  •  渐次进展
    2020-12-01 17:44

    For maximum customization, In your xml, you can use a FrameLayout as a container

       
    
        
    
    

    Now in your Activity, you can replace it with any fragment

    getSupportFragmentManager().beginTransaction().replace(R.id.contDrawer, SideBarCustomerFragment.newInstance()).commit();
    

    Now for two users, you can create 2 different fragments, You can check my boilerplate code for reference

    https://github.com/hamzaahmedkhan/AndroidStructure/blob/master/app/src/main/java/com/android/structure/activities/HomeActivity.java

    https://github.com/hamzaahmedkhan/AndroidStructure/blob/master/app/src/main/java/com/android/structure/activities/BaseActivity.java

提交回复
热议问题