显示回到操作栏按钮 [英] Display back button on action bar
本文介绍了显示回到操作栏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示操作栏
在返回按钮
移动previous页/活动或到主页(第一开口)。
我不能做到这一点。
I'm trying to display a Back button
on the Action bar
to move previous page/activity or to the main page (first opening).
And I can not do it.
我的code。
ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
在code是在的onCreate
。
推荐答案
嗯,这是简单的显示后退按钮
well this is simple one to show back button
actionBar.setDisplayHomeAsUpEnabled(true);
然后就可以自定义在onOptionsItemSelected后面的事件
and then you can custom the back event at onOptionsItemSelected
case android.R.id.home:
this.finish();
return true;
这篇关于显示回到操作栏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文