我有一个自定义对话框,它在View底部有一个EditText。当我选择EditText时,键盘出现但在对话框中隐藏了EditText。我知道您可以将windowSoftInputMode用于Activity,引用资料说您可以使用Window.setSoftInputMode()对于非Activity..但是如何做到这一点???Reference我试过这样做GettingKeyboardToAppearWithoutHavingToClickonEditText但是之后Dialog.show();我放了getWindow().setSoftInputMode(WindowManager.
我在主Activity的onCreate中有以下代码:getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);我的layout-land/main.xml中有以下代码为什么softinput叠加在UI之上,但在横向模式下不会改变其大小?我怎样才能使具有软输入的UI在横向模式下的行为与在纵向模式下的行为相同?
在我的Android项目中,我希望只有一个fragment的softInputMode为adjustPan。将以下行添加到我的list(在Activity内)按预期工作:android:windowSoftInputMode="adjustPan"但我fragment中的以下几行什么都不做:@OverridepublicvoidonResume(){super.onResume();getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);}@Override