在有实体包括虚拟按键menu的手机上,Overflow是会自动隐藏的,我们需要屏蔽才能显示出“三个点”
//屏蔽实体菜单键
private void getOverflowMenu() {
try {
ViewConfiguration mconfig = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class
.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(mconfig, false);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}