Android 如何使用;“调整盘”;及;“调整大小”;在一起

Android 如何使用;“调整盘”;及;“调整大小”;在一起,android,window-soft-input-mode,Android,Window Soft Input Mode,我正面临一个棘手的问题。我在一个活动中有两个片段。一个是登录页面。我在这个片段中有两个编辑文本。我在清单中指定了adjustPan,该字段通过软键隐藏的一些设备工作正常 当用户单击LoginFragment上的按钮时,我打开了另一个名为forgetpassword的片段。这是一个webview,url正在从远程服务器加载。但是html中的文本字段被软键盘隐藏。所以我试着使用adjustResize,效果很好。但我的loginfragment中的editText小部件被键盘隐藏 如何在活动中实现这

我正面临一个棘手的问题。我在一个活动中有两个片段。一个是登录页面。我在这个片段中有两个编辑文本。我在清单中指定了adjustPan,该字段通过软键隐藏的一些设备工作正常

当用户单击LoginFragment上的按钮时,我打开了另一个名为forgetpassword的片段。这是一个webview,url正在从远程服务器加载。但是html中的文本字段被软键盘隐藏。所以我试着使用adjustResize,效果很好。但我的loginfragment中的editText小部件被键盘隐藏

如何在活动中实现这两个标志。
请帮我解决这个问题。

您可以通过编程设置
adjustPan
adjustResize
来解决问题

当当前片段是您的
登录片段时,使用以下代码设置
ajustPan

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
当当前片段是您的
webview片段时,使用以下代码设置
ajustResize

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

您可以通过编程方式设置
adjustPan
adjustResize
来解决问题。
此外,在
列表视图中添加
android:transcriptMode=“alwaysScroll”
adjustResize
adjustPan
不能相互组合。它们是防止软输入覆盖输入字段的不同默认操作。如WindowManager.LayoutParams.SOFT\u INPUT\u ADJUST\u PAN的注释所示

    /** Adjustment option for {@link #softInputMode}: set to allow the
     * window to be resized when an input
     * method is shown, so that its contents are not covered by the input
     * method.  This can <em>not</em> be combined with
     * {@link #SOFT_INPUT_ADJUST_PAN}; if
     * neither of these are set, then the system will try to pick one or
     * the other depending on the contents of the window. If the window's
     * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
     * value for {@link #softInputMode} will be ignored; the window will
     * not resize, but will stay fullscreen.
     */
    public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
{@link#softInputMode}的调整选项:设置为允许 *输入时要调整大小的窗口 *方法,以便其内容不被输入覆盖 *方法。这是不能与之相结合的 *{@link#软输入"调整"};如果 *这两个都未设置,则系统将尝试选择一个或多个 *另一个取决于窗口的内容。如果窗户开着 *布局参数标志包括{@link#FLAG_FULLSCREEN},这是 *{@link#softInputMode}的值将被忽略;窗户会关上的 *不调整大小,但将保持全屏。 */ 公共静态最终整数软输入调整大小=0x10;
在清单中放置调整平移时,这可以正常工作,但在尝试将两个标志放置在具有以下标志的片段中时,如getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT\u INPUT\u adjust\u RESIZE | WindowManager.LayoutParams.SOFT\u INPUT\u adjust\u pan);不应该把它们组合在一起,嘿,你找到解决办法了吗?我也面临同样的问题。