由于不同设备之间对于actionBar左面隐藏部分,4.2以后会有省略号,而之前的版本需要点击虚拟按键菜单才可以调用出来,此方法就是强制转换4.2版本以下右面省略号
/** 设备配置改变时 */
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mActionBarDrawerToggle.onConfigurationChanged(newConfig);
}
private void getOverflowMenu() {
ViewConfiguration viewConfig = ViewConfiguration.get(this);
try {
Field overflowMenuField = ViewConfiguration.class
.getDeclaredField("sHasPermanentMenuKey");
if (null != overflowMenuField) {
overflowMenuField.setAccessible(true);
overflowMenuField.set(viewConfig, false);
}
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}