I am working on android application. I have to add a menu on the left side of Action Bar. I am able to add menu on the right side but along with right side menu, I also want to add a menu on left side of Action Bar just like :
I have spent hours on searching how to achieve that left side menu, but no success. How can I achieve that? Thanks!
This is called Navigation Drawer
, You can look at the official android tutorial here, and this one too
If you are not specifically into the navigational drawer, like a back button or anything you like, you can use
ActionBar actionbar = getSupportActionBar();
actionbar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
and call
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() ==android.R.id.home){
//todo work here
return true;
}
return super.onOptionsItemSelected(item);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With