gpt4 book ai didi

android - 输入字段通过键盘重叠并在使用 Cordova 6.3.1 在 Android 中输入第一个字符后向上滚动

转载 作者:行者123 更新时间:2023-11-28 03:49:07 24 4
gpt4 key购买 nike

遇到一个奇怪的问题。当我点击任何文本字段进行编辑时,会弹出软键盘。但是这个领域仍然隐藏在下面。但是只要我从键盘上输入任何字符,它就会自动向上滚动并到达正确的位置。[附图片]

键盘出现在 Pin 代码 字段的焦点上并与它重叠。 enter image description here

我一开始打字,屏幕就会重新定位。我输入了“7” enter image description here

我的config.xml

 <?xml version='1.0' encoding='utf-8'?>
<widget id="com.appid.something" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Name of the app</name>
<description>
Some description
</description>
<author email="my email" href="link">
our team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-sqlite-storage" spec="~2.0.0" />
<preference name="Orientation" value="portrait" />
<preference name="fullscreen" value="false" />
<preference name="android-windowSoftInputMode" value="adjustResize"/>
<feature name="DatePickerPlugin">
<param name="android-package" value="com.sharinglabs.cordova.plugin.datepicker.DatePickerPlugin"/>
</feature>
</widget>

我的要求是,它应该在获得焦点后立即自动重新定位。

此外,在键盘打开模式下,滚动不会发生变化。

最佳答案

引用@Biswas Khayargoli 在 question 中的回答

添加了以下插件

cordova plugin add ionic-plugin-keyboard --save

在我的一个全局 js 文件中添加了代码来处理 native.keyboardshow 事件

 window.addEventListener('native.keyboardshow', function(e){ 
setTimeout(function() {
document.activeElement.scrollIntoViewIfNeeded();
}, 100);
});

关于android - 输入字段通过键盘重叠并在使用 Cordova 6.3.1 在 Android 中输入第一个字符后向上滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43817814/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com