去掉targetSdkVersionthis
或改成targetSdkVersion =13或更小。。spa
不改targetSdkVersion的辦法:
在onCreate() 裏setContentView()以後加入以下代碼便可。
try {
window.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(TAG, "Could not access FLAG_NEEDS_MENU_KEY in addLegacyOverflowButton()", e);
}get