与 EditText 字段重叠的软键盘

Soft Keyboard Overlapping with EditText Field(与 EditText 字段重叠的软键盘)

本文介绍了与 EditText 字段重叠的软键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 this 旧帖子肯定有助于解决我的问题,但我注意到它似乎并没有真正解决我的问题.我已经收集到我需要为我的活动设置 android:windowSoftInputMode="adjustPan" .但问题是它根本不够平移.

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.

文本字段位于视图的底部,当键盘出现时,视图会稍微移动,但只会移动到 EditText 的最顶部.文本字段已打开自动完成功能,当它开始显示自动完成选项时,视图会稍微向下平移,但实际上最终会被自动完成选项进一步遮挡.这使得文本输入字段很难使用,因为您看不到正在输入的任何内容.

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?

推荐答案

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

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" />

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

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.

这篇关于与 EditText 字段重叠的软键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:与 EditText 字段重叠的软键盘

基础教程推荐