软键盘与 EditText 字段重叠

发布于 2024-10-09 08:47:00 字数 497 浏览 3 评论 0原文

我发现 这篇旧帖子绝对有助于解决我的问题,但我注意到它似乎并没有真正解决我的问题。我发现我需要为我的活动设置 android:windowSoftInputMode="adjustPan" 。但问题是它根本不够平移。

文本字段位于视图的底部,当键盘显示时,视图会稍微移动,但只有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懷念過去 2024-10-16 08:47:00

所以,我找到了问题的原因。在我的 AndroidManifest.xml 中,我设置了

<uses-sdk android:minSdkVersion="3" />

显然,使用低于“4”的 minSdkVersion 是问题的根源。将其更改为“4”后,布局显示应有的样子,并且 EditText 的第一行相应地位于软键盘顶部上方。

谢谢你的帮助,福波斯。

So, I've found what appears to be the cause of the issue. In my AndroidManifest.xml I had set

<uses-sdk android:minSdkVersion="3" />

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.

吹梦到西洲 2024-10-16 08:47:00

将您的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文