如何去除Launcher默认的google search bar?

[DESCRIPTION]

如何去除Launcher默认的google search bar?

[SOLUTION]

JB2/JB3/JB5/JB9: 

 

1. 请修改 Launcher2/res/layout/qsb_bar.xml,如下:

    

        layout="@layout/search_bar"

        android:visibility="gone" /> 

 

2.  请修改Launcher2/res/layout-port/launcher.xml,将voice_button_proxy这个view的clickable设置为false,并去掉onClick="onClickVoiceButton",如下:

            android:id="@+id/voice_button_proxy"
            android:layout_width="80dp"
            android:layout_height="@dimen/qsb_bar_height"
            android:layout_gravity="top|right"
            android:clickable="false"  

            android:importantForAccessibility="no"
            launcher:sourceViewId="@+id/voice_button" />

 

3.  请修改Launcher2/src/com/android/launcher2/SearchDropTargetBar.java的onFinishInflate() 方法,如下:

......

        // Create the various 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.  请修改Launcher2/src/com/android/launcher2/SearchDropTargetBar.java的showSearchBar()方法,如下:

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:

 

1. 请修改Launcher3/res/layout-port/search_bar.xml,如下:

         xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="
http://schemas.android.com/apk/res-auto/com.android.launcher3"
    style="@style/SearchDropTargetBar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/search_frame"
    android:visibility="gone">

 

2.  请修改Launcher3/res/layout-port/launcher.xml,将voice_button_proxy这个view的clickable设置为false,并去掉onClick="onClickVoiceButton",如下:

                    android:id="@+id/voice_button_proxy"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_gravity="top|end"
            android:clickable="false"
            android:importantForAccessibility="no"
            launcher:sourceViewId="@+id/voice_button" />

 

3.  请修改Launcher3/src/com/android/launcher3/SearchDropTargetBar.java的setup()方法,如下:

......

        if (mEnableDropDownDropTargets) {
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "translationY", -mBarHeight,
                    -mBarHeight);
        } else {
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha", 0f, 0f);
        }

......

 

4.  请修改Launcher3/src/com/android/launcher3/SearchDropTargetBar.java的showSearchBar()方法,如下:

    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.  请修改Launcher3/src/com/android/launcher3/Workspace.java的getChangeStateAnimation()方法,如下:

......

        float finalSearchBarAlpha = !stateIsNormal ? 0f : 0f;

......

你可能感兴趣的:(Android,手机解决方案)