Android 9 屏蔽Launcher界面搜索框

  • 找到以下XML文件

packages/apps/Launcher3/res/layout/search_container_workspace.xml

查找android:name属性值为以下数据的fragment,将该fragment全部注释掉

android:name=com.android.launcher3.qsb.QsbContainerView$QsbFragment
  • 找到以下Java源文件

packages/apps/Launcher3/src/com/android/launcher3/Workspace.java

查找bindAndInitFirstWorkspaceScreen方法,将以下代码段去掉

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

猜你喜欢

转载自blog.csdn.net/weixin_41388144/article/details/109368361