由于弹出软键盘挡住了布局,很不舒服,对用户体验也不好,所以需要解决!
1、在清单文件的application节点内添加
android:windowSoftInputMode=”adjustResize|adjustUnspecified|stateHidden”
2、在需要的界面上添加
View decorView = getWindow().getDecorView();
View contentView = findViewById(Window.ID_ANDROID_CONTENT);
decorView.getViewTreeObserver()
.addOnGlobalLayoutListener(getGlobalLayoutListener(decorView, contentView));
private ViewTreeObserver.OnGlobalLayoutListener getGlobalLayoutListener(final<