【Android】Android 9.0 隐藏虚拟按键跟状态栏,除去google搜索栏.

  1. 隐藏虚拟按键跟状态栏
    1. 修改文件: frameworks/base/packages/SettingsProvider/res/values/defaults.xml
           cell,bluetooth,wifi,nfc,wimax
      +    immersive.full=*
           bluetooth,wifi,nfc
      

       policy_control 有三种值:

      全屏沉浸模式(包括状态栏和虚拟按键): immersive.full=*

      沉浸状态栏:immersive.status=*

      沉浸虚拟按键(隐藏后底部上划可以呼出): immersive.navigation=*

      恢复正常模式(如果隐藏了状态栏或者虚拟按键但是又不想用了):null

    2. 修改文件: frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

      函数 private void loadGlobalSettings(SQLiteDatabase db) 中加上如下代码:
                   loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON,
                           R.bool.def_airplane_mode_on);
      +                       loadStringSetting(stmt, Settings.Global.POLICY_CONTROL,
      +                    R.string.policy_control);
       
                   loadBooleanSetting(stmt, Settings.Global.THEATER_MODE_ON,
                           R.bool.def_theater_mode_on);
      

      Settings.Global.POLICY_CONTROL 定义在: frameworks/base/core/java/android/provider/Settings.java中         

  2. 除去google搜索栏

    1. 修改文件:packages/apps/Launcher3/res/layout/search_container_workspace.xml

      +
      将以上注释掉
      
      

       

    2. 修改文件:packages/apps/Launcher3/src/com/android/launcher3/Workspace.java

      在函数: public void bindAndInitFirstWorkspaceScreen(View qsb)  中
      +/*   除去Launcher3 自带的google 搜索框
               CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);
               lp.canReorder = false;
               if (!firstPage.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true)) {
                   Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
               }
      +        */
      
       注释掉以上代码即可
      

       

       

你可能感兴趣的:(Android)