android- 在同一 Activity 上使用 adjustResize 和 adjustPan
android- Use adjustResize and adjustPan on same Activity
我正在开发一个具有背景聊天图像和默认键盘的聊天应用程序,当我必须使用背景图像时它会缩小但是当我使用 android:windowSoftInputMode="adjustResize" 它完美地工作,但是键盘隐藏了编辑文本,如果我使用 android:windowSoftInputMode="adjustPan" 键盘显示完美但是图像缩小了,怎么能我在单个 Activity
上同时使用这两个选项
如果我在清单编辑文本中同时使用这两个选项,则文本已被隐藏
我遇到了同样的问题,我解决了这个问题,在需要时以编程方式设置 adjust
这是代码:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
和
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
根据documentation那些不能合并的:
android:windowSoftInputMode=["stateUnspecified",
"stateUnchanged", "stateHidden",
"stateAlwaysHidden", "stateVisible",
"stateAlwaysVisible", "adjustUnspecified",
"adjustResize", "adjustPan"]
The setting must be one of the values listed in the following table, or a combination of one "state..." value plus one "adjust..." value. Setting multiple values in either group — multiple "state..." values, for example — has undefined results. Individual values are separated by a vertical bar (|). For example:
我正在开发一个具有背景聊天图像和默认键盘的聊天应用程序,当我必须使用背景图像时它会缩小但是当我使用 android:windowSoftInputMode="adjustResize" 它完美地工作,但是键盘隐藏了编辑文本,如果我使用 android:windowSoftInputMode="adjustPan" 键盘显示完美但是图像缩小了,怎么能我在单个 Activity
上同时使用这两个选项如果我在清单编辑文本中同时使用这两个选项,则文本已被隐藏
我遇到了同样的问题,我解决了这个问题,在需要时以编程方式设置 adjust
这是代码:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
和
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
根据documentation那些不能合并的:
android:windowSoftInputMode=["stateUnspecified", "stateUnchanged", "stateHidden", "stateAlwaysHidden", "stateVisible", "stateAlwaysVisible", "adjustUnspecified", "adjustResize", "adjustPan"]
The setting must be one of the values listed in the following table, or a combination of one "state..." value plus one "adjust..." value. Setting multiple values in either group — multiple "state..." values, for example — has undefined results. Individual values are separated by a vertical bar (|). For example: