标签:except create 酷派 exception key msu har get java
实机使用酷派大神F1,添加menu后,右上角不出现菜单,此时在java代码中加入以下方法在onCreate中运行
private void makeActionOverflowMenuShown() {
//devices with hardware menu button (e.g. Samsung Note) don‘t show action overflow menu
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
}
}
加入此代码后,再测试即可出现菜单选项
标签:except create 酷派 exception key msu har get java
原文地址:http://www.cnblogs.com/ylqs/p/6624112.html