Android5.1 Launcher3 隐藏搜索条

  需要修改五个地方:

  1.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);
        }

  2.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;
    }

  3.Launcher3/src/com/android/launcher3/Workspace.java的getChangeStateAnimation()方法,如下:

......

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

......

  4.Launcher3/res/layout-land/launcher.xml,如下:

                    android:id="@+id/search_drop_target_bar"
            layout="@layout/search_drop_target_bar"
            android:visibility="gone" />

  5.Launcher3/res/layout-port/launcher.xml,如下:

                    android:id="@+id/search_drop_target_bar"
            layout="@layout/search_drop_target_bar"
            android:visibility="gone" />

你可能感兴趣的:(Android相关)