FLAG_NEEDS_MENU_KEY cannot be resolved or is not a field
报错,程序无法运行
报错,程序无法运行
2015-04-14
把getWindow().setFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY,
WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);这句话 换成
try {
getWindow().addFlags(WindowManager.LayoutParams.class.getField("FLAG_NEEDS_MENU_KEY").getInt(null));
}catch (NoSuchFieldException e) {
// Ignore since this field won't exist in most versions of Android
}catch (IllegalAccessException e) {
Log.w("feelyou.info", "Could not access FLAG_NEEDS_MENU_KEY in addLegacyOverflowButton()", e);
}
就ok了 ,亲测。
举报