且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Phonegap Android键盘覆盖了输入元素,滚动已禁用

更新时间:2022-10-15 22:46:34

对于config.xml中的大多数情况,请将全屏偏好设置更改为false.可以解决问题.

<preference name="fullscreen" value="false" />

I've tried many different solutions and nothing is quite what I want. What I want is for the keyboard to show on top of the content (keeping the content the same size) while being able to scroll to input elements that are covered by the keyboard.

Every solution I've tried will either give me one or the other, but not both.

Solutions I've tried:

  • Solution here. Adding android:windowSoftInputMode="adjustPan" and android:configChanges="orientation|keyboardHidden" to the main activity in my AndroidManifest.xml.
  • The above solution using "adjustResize" instead of "adjustPan".
  • Solution here. Adding to my confix.xml.

Using adjustPan keeps my elements the same size, but disables scrolling. Using adjustResize resizes the entire page, making everything miniature. Keeping default settings, only the wrapper containing the input elements is resized, but scrolling is enabled.

I managed to find the exact same problem (unanswered) here. They were able to "fix" it by resizing their app to 150% and scroll to the covered input element, but like they said it's not ideal.

Any help is appreciated.

For most of the cases in config.xml change the full screen preference to false. that'll do the trick.

<preference name="fullscreen" value="false" />