如何禁用/隐藏 ICS 手机上的三点指示器(选项菜单指示器) [英] How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets

查看:32
本文介绍了如何禁用/隐藏 ICS 手机上的三点指示器(选项菜单指示器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在没有菜单按钮的 ICS 手机上禁用/隐藏三点指示器(选项菜单指示器).?

How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets which does't have menu button. ?

我在 Manifest 中以 <uses-sdk android:minSdkVersion="5"/> 运行应用程序,代码使用 4.0 编译.三点指示器显示在每个屏幕上.

I am running application as <uses-sdk android:minSdkVersion="5"/> in Manifest, code is compiled with 4.0. Three-dot indicator shows on every screen.

我不想显示三点指示器的偏好活动示例,因为它没有任何菜单选项.

Example for preference activities i don't want show Three-dot indicator, since it does't have any menu options.

在清单中添加 android:targetSdkVersion="14" 就可以了.但是不想在所有屏幕上隐藏/删除三点按钮.只有在偏好活动中不想显示这个三点按钮.

Adding android:targetSdkVersion="14" in manifest it works. However don't want hide/remove three dots button on all screens . Only in preference activities don't want to show this three dots button.

推荐答案

在首选项的片段中覆盖 onPrepareOptionsMenu() :

Override onPrepareOptionsMenu() in the fragment of the preference with this:

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item= menu.findItem(R.id.menu_settings);
    item.setVisible(false);
    super.onPrepareOptionsMenu(menu);
    return true;
}

如果您有多个项目,请将所有项目的可见性标志设置为 false

if you have more then one item set all the items visibility flag to false

并添加命令 setHasOptionsMenu(true);onCreate 命令

and add the command setHasOptionsMenu(true); to the onCreate command

在您将项目的所有可见性设置为 false 后,菜单将消失

after you will set all the visibility of the items to false the menu will disappear

关于活动,唯一的区别是 onPrepareOptionsMenuboolean 并且您不需要添加 setHasOptionsMenu(true); 命令关于创作

on activity, the only difference is the onPrepareOptionsMenu is boolean and you don't need to add the setHasOptionsMenu(true); command on the creation

这篇关于如何禁用/隐藏 ICS 手机上的三点指示器(选项菜单指示器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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