5

我需要在表单上显示唯一的组件 - HTMLComponent。在垂直滚动滚动条跳回表单顶部时到达表单/组件的底部。我需要防止这种情况。

我试图打开/关闭表单上的滚动,HTMLComponent但无论如何如果有一个滚动条 - 它会从底部返回到顶部。我也尝试过边框和框布局以及其他容器HTMLComponent- 没用。

任何想法如何防止这种滚动问题?

4

8 回答 8

1

如果你想摆脱底部/顶部跳转滚动,你可以使用

form.setCyclicFocus(false)

于 2011-04-29T13:21:02.907 回答
1

您应该坚持使用边框布局并将 HTML 组件放置在此特定用例的中心。您可以禁用表单滚动,因为默认情况下 HTML 组件确实是可滚动的:

form.setScrollable(false);
于 2011-05-19T09:29:14.150 回答
1

试试这个(它适用于我 - LWUIT 1.5):

htmlComponent.getComponentForm().setCyclicFocus(false);

如果您得到 a ,请在添加到表单NullPointerException后调用它。HtmlComponent

于 2011-11-06T18:03:41.277 回答
0

HTMLComponent 本身是可滚动的

防止滚动

setScrollable(false);

用于水平滚动关闭

setScrollableX(false);

希望这能解决你的问题

于 2011-04-28T16:50:11.313 回答
0

...或者,您可以将此代码粘贴到您的 Form 类上

public void keyPressed(int keyCode) {
    int tecla = Display.getInstance().getGameAction(keyCode);

    if(tecla == 8){
        //if hit ENTER or principal key in mobile keyboard
    }else if(tecla == 6){//down key
        if(this.list_component_name.getSelectedIndex() < this.list_component_name.size() - 1)
            this.list_component_name.setSelectedIndex(this.lista_bodegas.getSelectedIndex() + 1);
    }else if(tecla == 1){//up key
        if(this.list_component_name.getSelectedIndex() > 0)
            this.list_component_name.setSelectedIndex(this.list_component_name.getSelectedIndex() - 1);
    }
}

这对我也有用

于 2011-06-01T04:49:44.337 回答
0

form.serScrollable(false)或者form.setCyclicFocus(false)对我不起作用。我有一个表格,里面只有一个HTMLComponent
问题HTMLComponent本身就是问题,禁用表单的焦点不会影响它。

于 2011-10-08T08:32:56.360 回答
0

您可以尝试使整个组件具有焦点,这可能有助于以正确的方式滚动。除此之外,您应该在表单的 Boderlayout.center 中添加您的 html 组件,并使表单可滚动为真,循环焦点为假。

于 2012-09-24T07:12:11.637 回答
0

在 LWUITImplementation 中,我们有函数 getDragPathTime()。这个关于这个功能的javaDoc:

 /**
 * Indicates what drag points are valid for the drag speed calculation.
 * Points that are older then the current time - the path time are ignored
 * 
 * @return the relevance time per point
 */

我也遇到了问题,尤其是在 OS S-60 Nokia 的设备上。列表从底部跳到顶部。我通过更改返回值解决了这个问题。我将值更改为 600(从 200)。这会减少采样并防止“跳跃”。

于 2012-12-10T12:09:32.063 回答