閱讀832 返回首頁    go 阿裏雲 go 技術社區[雲棲]


如何讓有物理鍵的手機在ActionBar始終顯示更多菜單menu鍵

僅作記錄代碼用,功能未能測試成功,在低版本上不存在 sHasPermanentMenuKey 屬性,會出現 java.lang.NoSuchFieldException: sHasPermanentMenuKey 異常




        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();
        }


最後更新:2017-04-03 12:55:38

  上一篇:go 關於Ubuntu 下新開發板adb 無法識別的問題(成功案例:解決了三星,索愛,OPPO X903案例)
  下一篇:go 今日成為CSDN認證專家