android:显示虚拟键盘时如何防止调整窗口大小
我正在使用选项卡式应用程序。我的应用程序有一个 EditText。当我单击 EditText 时,窗口将调整大小,并且虚拟键盘将显示在窗口底部。但四个选项卡显示在键盘顶部。
当显示键盘时,我不想显示我的选项卡。或者我不想调整窗口大小。我的需要只是隐藏 EditText 下面的选项卡和其他内容。
我在清单中使用“android:windowSoftInputMode”的所有选项。但我看不出任何差异。
请给我解决方案。
谢谢..
I am using a tabbed application. There is an EditText my application. When I click on the EditText, the window is getting resized and the virtual keyboard is displaying at the bottom of the window. But the four tabs are displaying at the top of the keyboard.
I do not want to display my tabs, when the keyborad is displaying. Or I do not want to resize my window. My need is just to hide the tabs and other things below the EditText.
I use all options with 'android:windowSoftInputMode' in my manifest. bUT I can not see any differences.
Please give me the solution.
Thank you..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了解决方案..专门针对“sencha/phonegap/cordova”用户。
编辑android清单文件中的主要活动添加此属性。
android:windowSoftInputMode =“调整Nothing”
I found the solution.. for specially "sencha/phonegap/cordova" users.
Edit the main activity in android manifest file add this attribute.
android:windowSoftInputMode="adjustNothing"
当虚拟键盘出现时,视图不会调整大小,但会移动。请参阅此博客文章以防止这。
另请参阅
在 Android 中处理键盘输入
When Virtual keyboard comes, the view is not re-sized but it gets moved. See this blog post to prevent this.
See also
Handling keyboard input in Android
我有同样的问题,但我认为 Mudassir 建议的博客文章没有帮助。我不希望移动窗口或调整窗口大小或进行任何操作,因此
adjustPan
和adjustResize
都不起作用。我只是希望它保持我的窗口位置不变。
我发现我可以调用
getWindow
,然后将 y 位置 和 重力 设置为top|center_horizontal
并修复它适用于键盘出现时它们不与键盘重叠的窗口。对于部分被键盘覆盖的大窗口,似乎没有解决方案可以防止键盘推动它们。
I have the same problem and I don't find the blog post suggested by Mudassir helpful. I don't want my window moved or resized or anything so neither
adjustPan
noradjustResize
works.I just want it to leave my windows position unchanged.
I found that I can call
getWindow
and then set the y position and gravity totop|center_horizontal
and that fixes it for windows where they don't overlap with the keyboard when the keyboard appears.For large windows that are partially covered by the keyboard there doesn't seem to be a solution to prevent the keyboard from pushing them around.