Back to home

Android4.0系统以上程序不出现菜单键的问题解决

2015-08-06 12:49:33 -0400
①去掉targetSdkVersion

②或改为targetSdkVersion =13或更小。。



不改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);
}
«Newer      Older»

----Comments(1)----
0℃的回※忆~★ (@zhaofuzhon) | @ at 2017-03-18 20:42:
http://suo.im/4yBbEk
Comment:
Name:

Back to home

Subscribe | Register | Login | N