如何调整AlertDialog键盘显示器上器上、键盘、AlertDialog

2023-09-04 03:05:59 作者:怪咖 -◎

好吧,我有一个AlertDialog盒子,上面有大约10控件(文本和TextView的)。这些控件与alertdialog一个滚动视图,加上我有2个按钮正面和负面的。这个问题我已经是当软键盘弹出的两个按键是隐藏在键盘后面。

Okay I have a AlertDialog box with approximately 10 controls (text and textview) on it. These controls are in a scrollview with alertdialog, plus I got 2 buttons positive and negative. The issue I have is when the soft keyboard pops up the two buttons are hidden behind the keyboard.

我一直在寻找类似重绘功能在我的内心视图或对话框。

I was looking for something like redraw function on my inner View or the dialog box.

如果任何人有任何想法,请帮助。下面是截图什么,我说什么。

If any one has any idea please help. Below is the screen shot of what I am talking about.

推荐答案

如果您的对话框是使用的对话主题之一,​​你可以通过设置实现这种行为的活动 adjustResize 标记为活动的 windowSoftInputMode 参数。

If your dialog was an activity using one of the Dialog themes you could effect this behavior by setting the adjustResize flag for the windowSoftInputMode parameter of the activity.

我使用的是:

android:windowSoftInputMode="adjustResize|stateHidden"

我觉得你还是可以使用这个标志定期对话,但我不知道如何使用它。您可能需要使用自定义主题,继承了正确的父主题创建AlertDialog,并设置一个标志,或者您可能需要使用ContextThemeWrappers之类的东西。

I think you can still use this flag with regular dialogs, but I'm not sure how to apply it. You may have to create your AlertDialog with a custom theme that inherits the right parent theme and also sets that flag, or you might have to use ContextThemeWrappers and stuff.

或者你可以只使用Window#setSoftInputMode.

alertDialog.getWindow().setSoftInputMode(
    WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);