Android中ActionBar中显示overflow

//force to show overflow menu in actionbar for android 4.4 below

    private void getOverflowMenu() {
         try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
            if(menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
posted @ 2015-08-18 17:47  williamgufeng  阅读(164)  评论(0编辑  收藏  举报