Android Web 视图中隐藏在键盘下方的文本框
我创建了一个简单的 iPhone/Android 应用程序,包含一个普通的 Web 视图。这个网络视图调用我的网站。
在我的网站上有几种输入类型=文本或文本区域的表单。当它们位于页面底部时,我遇到了问题!
1)在我的iPhone应用程序中,键盘会自动出现并将文本框推到手机屏幕的可见区域。所以没什么可做的。
2)但在我的 Android 应用程序中,文本框将保留在同一位置,并最终被我的键盘隐藏。因此用户唯一的选择就是输入“blind”。
我该如何解决这个问题?还有其他人遇到这个问题吗?
I have created a simple iPhone/Android app, containing a normal webview. This webview calls my website.
On my website there are several forms with input type=text or textarea. I have a problem with those when they are at the bottom of the page!
1) In my iPhone app, the keyboard will automatically appear and push the textbox to the visible area of the phone screen. So there is nothing to do.
2) But in my Android app the textbox will stay at the same place and is eventually hidden by my keyboard. So the only option users have is to type "blind".
How can I fix this? Did anyone else meet this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这就是我解决问题的方法。正如 Venky 所说,您必须添加
到 AndroidManifest.xml 文件中的标记。但就我们而言,这还不够。确保您也对视图、网络视图等执行此操作。然后我们终于让它发挥作用了。
This is how I solved the problem. As Venky said, you have to add
to your tag in the AndroidManifest.xml file. But in our case, it wasn't enough. Make sure you do this as well with your views, webviews etc. Then we finally made it work.
我快疯了,没有任何效果
android:windowSoftInputMode="adjustResize"
可能有帮助,但请确保您的应用程序不是全屏显示。删除我的应用程序的全屏解决了使用软键盘调整布局大小的问题。
I was getting crazy nothing works
android:windowSoftInputMode="adjustResize"
may help but be sure to have your app not in full screen.Removing full screen for my app solved the problem with the layout resize with softkeyboard.
对于全屏模式下的活动, android:windowSoftInputMode="adjustResize" 将不起作用。
https://developer.android.com/reference/android/view /WindowManager.LayoutParams.html#FLAG_FULLSCREEN
我在活动中使用以下方法通过设置底部填充来调整布局大小:
For activities in full screen mode, android:windowSoftInputMode="adjustResize" will not work.
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_FULLSCREEN
I use the following method in the activity to resize the layout by setting a bottom padding:
这可行:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
This would work:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
在解决这个问题时我学到了一些东西——
1.主题样式不应包含Fullscreen True
2.添加 android:windowSoftInputMode="adjustResize"
3. 删除 android:scrollbars="none" 是任何..
干杯!
Few things I learnt while solving this issue ---
1. Theme style should not contain Fullscreen True
2. Add android:windowSoftInputMode="adjustResize"
3. Remove android:scrollbars="none" is any.. .
Cheers!
除了建议答案之外,其他方法都无法工作
请注意,当您处于沉浸式模式时,
Beware that apart from the suggest answers
Is not working when you are in immersive mode
就我而言,成功是通过以下方式实现的:
将以下内容添加到清单、webview 和片段:
使用非全屏主题,如下所示:
In my case the succes achieved by:
Adding below to manifest, webview and fragment:
Using NON FullScreen Theme such as below:
是的,在使用 Webview 时遇到了同样的问题,我的问题是在模态上提交的输入。文本字段没有“聚焦”在键盘上方。
解决方案是延迟函数调用。希望有人觉得这有用。
正如你所看到的,它用于 jstree 输入...
}
Yeah, had the same problem working with Webview, mine was with input filed on modal. Textfield didn't "focus" above the keyboard.
The solution was to delay the function call. Hope someone finds this usefull.
As you can see it's used for jstree input...
}