Android 去掉 Launcher3 里面默认的Google搜索条

过gms需要去掉Google原生系统里面的搜索条。

Android 6.0

在Launcher3里面src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java

--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3465,6 +3465,10 @@ public class Launcher extends Activity
     }

     public View getOrCreateQsbBar() {
+
+       if(true){
+        return null;
+       }
         if (mLauncherCallbacks != null && mLauncherCallbacks.providesSearch()) {
             return mLauncherCallbacks.getQsbBar();
         }

直接返回null,就OK; 

Android 7.1 系统

diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 3a25d68..1247875 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -65,11 +65,11 @@
android:layout_marginBottom="30dp"/>

<!-- A place holder view instead of the QSB in transposed layout -->
- <View
+ <!-- <View
android:layout_width="0dp"
android:layout_height="10dp"
android:id="@+id/workspace_blocked_row" />
-
+-->
<include layout="@layout/widgets_view"
android:id="@+id/widgets_view"
android:layout_width="match_parent"
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 2c9dc3e..cd922b8 100755
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1324,7 +1324,9 @@ public class Launcher extends Activity
mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-
+ //add by neil
+ mDragLayer.removeView(mQsbContainer);
+ //end
// Setup the drag layer
mDragLayer.setup(this, mDragController, mAllAppsController);

diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 3ac9773..d3b6224 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1620,11 +1620,11 @@ public class LauncherModel extends BroadcastReceiver

if (!occupied.containsKey(item.screenId)) {
GridOccupancy screen = new GridOccupancy(countX + 1, countY + 1);
- if (item.screenId == Workspace.FIRST_SCREEN_ID) {
+ // if (item.screenId == Workspace.FIRST_SCREEN_ID) {
// Mark the first row as occupied (if the feature is enabled)
// in order to account for the QSB.
- screen.markCells(0, 0, countX + 1, 1, FeatureFlags.QSB_ON_FIRST_SCREEN);
- }
+ // screen.markCells(0, 0, countX + 1, 1, FeatureFlags.QSB_ON_FIRST_SCREEN);
+ // }
occupied.put(item.screenId, screen);
}
final GridOccupancy occupancy = occupied.get(item.screenId);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 340177d..2297ee4 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -618,7 +618,7 @@ public class Workspace extends PagedView
});
}
// Always add a QSB on the first screen.
- if (qsb == null) {
+ /* if (qsb == null) {
// In transposed layout, we add the QSB in the Grid. As workspace does not touch the
// edges, we do not need a full width QSB.
qsb = mLauncher.getLayoutInflater().inflate(
@@ -626,12 +626,12 @@ public class Workspace extends PagedView
? R.layout.qsb_container : R.layout.qsb_blocker_view,
firstPage, false);
}
-
- CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);
- lp.canReorder = false;
- if (!firstPage.addViewToCellLayout(qsb, 0, getEmbeddedQsbId(), lp, true)) {
+*/
+ // CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), 1);
+ // lp.canReorder = false;
+ /* if (!firstPage.addViewToCellLayout(qsb, 0, getEmbeddedQsbId(), lp, true)) {
Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
- }
+ }*/
}

@Override
@@ -779,6 +779,9 @@ public class Workspace extends PagedView
CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
int spanX = customScreen.getCountX();
int spanY = customScreen.getCountY();

+ android.util.Log.i("neil","spanX = "+spanX+"spanY = "+spanY);
+
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY);
lp.canReorder = false;
lp.isFullscreen = true;
--------------------- 
作者:zhongruichun 
来源:CSDN 
原文:https://blog.csdn.net/zhongruichun/article/details/77881002 
版权声明:本文为博主原创文章,转载请附上博文链接!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值