您的位置:首页 > 其它

[安卓开发]在有物理按键的设备上依旧在Action Bar中显示虚拟菜单键

2013-04-03 12:22 316 查看
只要在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) {
// Ignore
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐