如何去除launcher 上默认的 google search bar.

MT6515/75/17/77 Android ICS/ICS2请参考如下改法:
1: Launcher2\res\layout\qsb_bar.xml中,
            layout="@layout/search_bar"
        android:visibility="gone" /> //加入 android:visibility="gone"
 
2: Launcher2\src\com\android\launcher2\SearchDropTargetBar.java 中
onFinishInflate() 方法内,将mQSBSearchBarFadeInAnim相关的部分作如下修改:
mQSBSearchBarFadeInAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha", 0f); //最后一个参数改为 0f, 原来是 1f
        mQSBSearchBarFadeInAnim.setDuration(sTransitionInDuration);
        mQSBSearchBarFadeInAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                mQSBSearchBar.setVisibility(View.INVISIBLE); //参数改为 View.INVISIBLE, 原来是 View.VISIBLE
 
3: 仍然是此 java 文件,将showSearchBar() 方法作如下修改:
public void showSearchBar(boolean animated) {
             if (LauncherLog.DEBUG) LauncherLog.d(TAG, "(SearchDropTargetBar)showSearchBar animated = " + animated);
        cancelAnimations();
        if (animated) {
            mQSBSearchBarFadeInAnim.start();
        } else {
            mQSBSearchBar.setVisibility(View.INVISIBLE); //参数改为:View.INVISIBLE
            mQSBSearchBar.setAlpha(0f); //参数改为 0f.
        }
        mIsSearchBarHidden = false;
    }
            }
        });

 






MT6515/75/17/77 Android JB

1: Launcher2\res\layout\qsb_bar.xml中,
            layout="@layout/search_bar"
        android:visibility="gone" /> //加入 android:visibility="gone"
 
2: Launcher2\src\com\android\launcher2\SearchDropTargetBar.java 中
onFinishInflate() 方法内,将mQSBSearchBarAnim 相关的部分作如下修改:
// Create the various fade animations
        if (mEnableDropDownDropTargets) {
            mDropTargetBar.setTranslationY(-mBarHeight);
            mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "translationY",
                    -mBarHeight, 0f);
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "translationY",-mBarHeight,
                    -mBarHeight); //modify 3rd para to -mBarHeight
        } else {
            mDropTargetBar.setAlpha(0f);
            mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
            mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha", 0f, 0f); //modify 3rd para to 0f;
        }
 
3: 仍然是这只 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); //参数改为 0f;
            }
        }
        mIsSearchBarHidden = false;
    }
 

你可能感兴趣的:(android)