软键盘与 EditText 字段重叠
文本字段位于视图的底部,当键盘显示时,视图会稍微移动,但只有 EditText 的最顶部。文本字段已打开自动完成功能,当它开始显示自动完成选项时,视图会稍微向下平移,但实际上会被自动完成选项进一步遮挡。这使得文本输入字段非常难以使用,因为您看不到正在输入的任何内容。
它是一个多行输入字段,当文本滚动到下一行时,视图会平移得更远,因此您实际上可以看到前一行文本。但你看不到你正在输入的内容,我认为这非常重要。
有人对解决这个问题有什么想法吗?
I found this old post which definitely helps with my problem, but I'm noticing that it doesn't really seem to solve my problem. I have gathered that I need to set android:windowSoftInputMode="adjustPan" for my activity. But the issue is that it simply doesn't pan ENOUGH.
The text field is toward the bottom of the view, and when the keyboard shows up, the view shifts slightly but only the very top of the EditText. The text field has autocomplete turned on, and when it begins to show autocomplete options, the view pans down slightly more, but actually winds up even further obscured by the autocomplete options. It makes the text input field very difficult to use since you can't see anything you're typing.
It is a multiline input field, and when text rolls to the next line, the view pans farther, so you can actually see the previous line(s) of text. But you cannot see what you're typing, which I think is pretty important.
Does anyone have any thoughts on solving this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以,我找到了问题的原因。在我的 AndroidManifest.xml 中,我设置了
显然,使用低于“4”的 minSdkVersion 是问题的根源。将其更改为“4”后,布局显示应有的样子,并且 EditText 的第一行相应地位于软键盘顶部上方。
谢谢你的帮助,福波斯。
So, I've found what appears to be the cause of the issue. In my AndroidManifest.xml I had set
Apparently, using a minSdkVersion below "4" was at the root of the problem. On changing it to "4", the layout appeared as it should have, and the EditText had its first line above the top of the soft keyboard appropriately.
Thanks for the help, Phobos.
将您的 UI 包装在 ScrollView 容器中。这将允许用户看到整个 UI,尽管如果需要的话可以通过滚动。如果屏幕上没有键盘,UI 可能不够大,无法滚动,但是当显示键盘时,它会有效地减小屏幕尺寸。
Wrap your UI in a ScrollView container. This will allow the user to see the entire UI, albeit by scrolling, if need be. The UI may not be big enough to scroll without the keyboard on screen, but when the keyboard is displayed it effectively reduces the screen size.