Android:如何删除操作栏中的“后退/主页"按钮 [英] android: how to remove the back/home button in the action bar

查看:100
本文介绍了Android:如何删除操作栏中的“后退/主页"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试从操作栏中删除后退/主页"按钮时遇到困难.

I am having difficulties trying to remove the back/home button from the action bar.

 getActionBar().setDisplayShowHomeEnabled(false);   //disable back button
 getActionBar().setHomeButtonEnabled(false);

在较旧的android手机中,使用这两个代码行删除了后退按钮.但是,对于联系4,后退按钮仍会出现,但只是被禁用了.另外,我只是在右侧添加一个菜单项,该菜单项的行为类似于后退/主页按钮,而不是后退/主页按钮.我想念什么?

In a older android phone, the back button is removed with these two code lines. However with the nexus 4, the back button still appears but is just disabled. Also I am just adding a menu item on the right that behaves like the back/home button replacing the back/home button. What am I missing?

推荐答案

使用getActionBar().setDisplayHomeAsUpEnabled(false)从操作栏中删除主页按钮.

Use getActionBar().setDisplayHomeAsUpEnabled(false) to remove the home button from the action bar.

这篇关于Android:如何删除操作栏中的“后退/主页"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆