本文介绍了处理高达导航的操作栏像后退导航。怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能处理最多的导航像后退导航?
How can I handle a Up navigation like a Back navigation?
是否有向上的导航像后退导航( onBack pressed()
)?
Is there a method for the Up navigation like for the Back navigation (onBackPressed()
)?
或者,我可以PROGRAMM的完成()
方法,当我preSS向上导航?
Or can I programm the finish()
method, when I press the Up navigation?
推荐答案
假设由向上导航你的意思上的应用程序图标自来水,你需要重写 onOptionsItemSelected()
在你的活动,并处理它,像这样:
Assuming by 'up navigation' you mean a tap on the app icon, you need to override onOptionsItemSelected()
in your activity and handle it like so:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// 'home' is the id for the icon click in the action bar (i.e. up/back).
if (item.getItemId() == android.R.id.home) {
// do your thing and return true
return true;
}
return super.onOptionsItemSelected(item);
}
这篇关于处理高达导航的操作栏像后退导航。怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!