Android Webview中TextArea字段的滚动问题



我有一个混合应用程序,在Android的webview中显示html元素。在这些HTML元素中,我有一个多行文本视图。一旦我在里面输入多行,比如1到20。我不能再滚动了。下面是对场景的解释

4 |
5 
6 
7 
8 
9 

在上面的场景中,如果我的光标位于4,1,2,3不可见,10,11....不可见以及它们在文本框之外。我无法向上滚动。如果我点8,光标就在8。我可以向上滚动到8,但不能超过。

我在三星Galaxy Note 10.1运行在OS 4.3上面临这个问题。在操作系统版本4.2.2上运行的多个设备上测试。

如有任何建议,将不胜感激。我的TextArea标签:

<textarea Class="abc" role="textbox" maxlength="100" tabindex="-1" rows="6" style="overflow-x: auto; overflow-y: auto;" ></textarea>

只需重写您的textarea字段。使用下面的代码

Ext.define('MyApp.util.TextArea', {
   override: 'Ext.form.TextArea',
adjustHeight: Ext.Function.createBuffered(function(textarea) {
    var textAreaEl = textarea.getComponent().input;
    if (textAreaEl) {
        textAreaEl.dom.style.height = 'auto';
        textAreaEl.dom.style.height = textAreaEl.dom.scrollHeight + "px";
    }
}, 200, this),
constructor: function() {
    this.callParent(arguments);
    this.on({
        scope: this,
        keyup: function(textarea) {
            textarea.adjustHeight(textarea);
        },
        change: function(textarea, newValue) {
            textarea.adjustHeight(textarea);
        } 
    });
}});

最新更新