I want to have the same drawer in all of my activities without having to manually:
- Copy paste it in each activity layout file.
- Populate it with the same content
- Store and remember its state
Are any or all of these points achievable?
I want to have the same drawer in all of my activities without having to manually:
Are any or all of these points achievable?
Just create a BaseActivity class that implements the drawer, and let all your other activities extend this one.
The below links could help you:
Android: Navigation-Drawer on all activities
Android Navigation Drawer on multiple Activities
U can replace the setContentView of Activity as given.
// setContentView(R.layout.activity_main);
LayoutInflater inflater = (LayoutInflater) getApplicationContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View contentView = inflater.inflate(R.layout.activity_main, null, false);
drawerLayout.addView(contentView, 0);