How to remove the default google search bar of Launcher ?, Launcherbar
JB2/JB3/JB5/JB9 version: 1. Modify Launcher2/res/layout/qsb_bar.xml as follows:
<Include android: id = "@ + id/qsb_search_bar"
Layout = "@ layout/search_bar"
Android: visibility = "gone"/> Add android: visibility = "gone" 2. Modify Launcher2/res/layout-port/launcher. xml as follows:
<Com. android. launcher2.DrawableStateProxyView
Android: id = "@ + id/voice_button_proxy"
Android: layout_width = "80dp"
Android: layout_height = "@ dimen/qsb_bar_height"
Android: layout_gravity = "top | right"
Android: clickable = "true"
OnClick = "onClickVoiceButton"
Android: importantForAccessibility = "no"
Launcher: sourceViewId = "@ + id/voice_button"/> modify android: clickable = "false" 3. Modify Launcher2/src/com/android/launcher2/SearchDropTargetBar. java
The onFinishInflate () method is as follows:
......
// Create the varous fade animations
If (mEnableDropDownDropTargets ){
MDropTargetBar. setTranslationY (-mBarHeight );
MDropTargetBarAnim = ObjectAnimator. ofFloat (mDropTargetBar, "translationY",-mBarHeight, 0f );
MQSBSearchBarAnim = ObjectAnimator. ofFloat (mQSBSearchBar, "translationY",-mBarHeight,-mBarHeight );
} Else {
MDropTargetBar. setAlpha (0f); mDropTargetBarAnim = ObjectAnimator. ofFloat (mDropTargetBar, "alpha", 0f, 1f );
MQSBSearchBarAnim = ObjectAnimator. ofFloat (mQSBSearchBar, "alpha", 0f, 0f );
}
... 4. Modify the attributes of Launcher2/src/com/android/launcher2/SearchDropTargetBar. java
The showSearchBar () method is as follows:
Public void showSearchBar (boolean animated ){
If (! MIsSearchBarHidden) return;
If (animated ){
PrepareStartAnimation (mQSBSearchBar );
MQSBSearchBarAnim. reverse ();
} Else {
MQSBSearchBarAnim. cancel ();
If (mEnableDropDownDropTargets ){
MQSBSearchBar. setTranslationY (0 );
} Else {
MQSBSearchBar. setAlpha (0f );
}
}
MIsSearchBarHidden = false;
} KK version: 1. Modify Launcher3/res/layout-port/search_bar.xml as follows:
<RelativeLayout
Xmlns: android = "http://schemas.android.com/apk/res/android"
Xmlns: launcher = "http://schemas.android.com/apk/resauto/
Com. android. launcher3"
Style = "@ style/SearchDropTargetBar"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: background = "@ drawable/search_frame"
Android: visibility = "gone"> Add android: visibility = "gone"
2. Modify Launcher3/res/layout-port/launcher. xml as follows:
<Com. android. launcher3.DrawableStateProxyView
Android: id = "@ + id/voice_button_proxy"
Android: layout_width = "0dp"
Android: layout_height = "0dp"
Android: layout_gravity = "top | end"
Android: clickable = "true"
Android: onClick = "onClickVoiceButton"
Android: importantForAccessibility = "no"
Launcher: sourceViewId = "@ + id/voice_button"/> modify android: clickable = "false"
3. Modify the settings of Launcher3/src/com/android/launcher3/SearchDropTargetBar. java
The setup () method is as follows:
......
If (mEnableDropDownDropTargets ){
MQSBSearchBarAnim = ObjectAnimator. ofFloat (mQSBSearchBar, "translationY",-mBarHeight,-mBarHeight );
} Else {
MQSBSearchBarAnim = ObjectAnimator. ofFloat (mQSBSearchBar, "alpha", 0f, 0f );
}
......
4. Modify the settings of Launcher3/src/com/android/launcher3/SearchDropTargetBar. java
The showSearchBar () method is as follows:
Public void showSearchBar (boolean animated ){
Boolean needToCancelOngoingAnimation =
MQSBSearchBarAnim. isRunning ()&&! Animated;
If (! MIsSearchBarHidden &&! NeedToCancelOngoingAnimation) return;
If (animated ){
PrepareStartAnimation (mQSBSearchBar );
MQSBSearchBarAnim. reverse ();
} Else {
MQSBSearchBarAnim. cancel ();
If (mEnableDropDownDropTargets ){
MQSBSearchBar. setTranslationY (0 );
} Else {
MQSBSearchBar. setAlpha (0f );
}
}
MIsSearchBarHidden = false;
}
5. Modify the settings of Launcher3/src/com/android/launcher3/Workspace. java
The getChangeStateAnimation () method is as follows:
......
Float finalSearchBarAlpha =! StateIsNormal? 0f: 0f; // The default value is 1f: 0f.
......