1:在AndroidManifest.xml中声明:键盘弹起的属性配置
<activity android:name=".Activity" android:screenOrientation="landscape" android:windowSoftInputMode="adjustUnspecified|stateHidden" android:configChanges="orientation|keyboardHidden"/>
2:
onCreate:
rootView = this.findViewById(android.R.id.content); rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { adjustWindow(); } });adjustWindow:
public enum keyboardState{ DISMISS, POPUP } private float eventY;