选项​​菜单中没有出现操作栏上的一些设备 [英] Options Menu does not appear in Action Bar on some devices

查看:205
本文介绍了选项​​菜单中没有出现操作栏上的一些设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在操作栏的选项菜单,它不会出现在具有硬件菜单按钮某些设备。我必须出现在动作条尽管有一个硬件按钮...
我该怎么办呢?

I have an options menu in the action bar, and it does not appear on certain devices which have hardware menu button. I must make it appear in the action bar despite having a hardware button... How can I do it?

推荐答案

的onCreate 方法将这个:

try {
    ViewConfiguration config = ViewConfiguration.get(this);
    Field menuKeyField = ViewConfiguration.class
            .getDeclaredField("sHasPermanentMenuKey");
    if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
    }
} catch (Exception ex) {
}

这篇关于选项​​菜单中没有出现操作栏上的一些设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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