1.
// topBarView.getViewTreeObserver().addOnGlobalLayoutListener(this);
2.
// topBarView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
3.
//注册监听视图树的观察者 // @Override // public void onGlobalLayout() { // final LinearLayout llIcon = this.mLlIcon; // Rect KeypadRect = new Rect(); // // topBarView.getWindowVisibleDisplayFrame(KeypadRect); // // int screenHeight = topBarView.getRootView().getHeight(); // // int keypadHeight = screenHeight - KeypadRect.bottom; // // //更新键盘激活状态 // if (keypadHeight > 0) { // updateKeyBoardActiveStatus(true); // } else { // updateKeyBoardActiveStatus(false); // } // // if (keypadHeight > 0 && llIcon.getTag() == null) { // final int height = llIcon.getHeight(); // final int width = llIcon.getWidth(); // this.mLogoHeight = height; // this.mLogoWidth = width; // llIcon.setTag(true); // LoginBusiness.setTopMarginAnimator(llIcon, height, 0, 1); // // LoginBusiness.setAlphaAnimator(llIcon, 1, 0); // } else if (keypadHeight == 0 && llIcon.getTag() != null) { // final int height = mLogoHeight; // llIcon.setTag(null); // LoginBusiness.setTopMarginAnimator(llIcon, height, 1, 0); // LoginBusiness.setAlphaAnimator(llIcon, 0, 1); // } // }
4.AndroidManifest.xml
android:windowSoftInputMode="adjustResize|stateHidden"
5.EditText
android:focusable="true" android:focusableInTouchMode="true"