我正在开发Android应用程序。我必须在Action Bar的左侧添加一个菜单。 我可以在右侧添加菜单,但是在右侧菜单中,我还想在Action Bar的左侧添加一个菜单,如:
我花了几个小时搜索如何实现左侧菜单,但没有成功。 我怎样才能做到这一点? 谢谢!
答案 0 :(得分:7)
答案 1 :(得分:0)
您无法将菜单左对齐。您应该使用自定义视图作为操作栏
答案 2 :(得分:0)
如果您不是特别喜欢导航抽屉,例如后退按钮或您喜欢的任何东西,可以使用
ActionBar actionbar = getSupportActionBar();
actionbar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
并致电
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() ==android.R.id.home){
//todo work here
return true;
}
return super.onOptionsItemSelected(item);
}