LWUIT滚动跳跃问题

时间:2011-04-28 12:01:23

标签: java-me lwuit

我需要在表单上显示唯一的组件 - HTMLComponent。到达窗体/组件的底部,而垂直滚动滚动条跳回到窗体的顶部。我需要阻止这一点。

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

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

8 个答案:

答案 0 :(得分:1)

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

form.setCyclicFocus(false)

答案 1 :(得分:1)

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

form.setScrollable(false);

答案 2 :(得分:1)

试试这个(它对我有用 - LWUIT 1.5):

htmlComponent.getComponentForm().setCyclicFocus(false);

如果您获得NullPointerException,请在将HtmlComponent添加到表单后将其调用。

答案 3 :(得分:0)

HTMLComponent本身是可滚动的

防止滚动

setScrollable(false);

水平滚动

setScrollableX(false);

希望这能解决您的问题

答案 4 :(得分: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);
    }
}

这对我也有用

答案 5 :(得分:0)

form.serScrollable(false)form.setCyclicFocus(false)对我不起作用。 我有一个表单,其中只有一个HTMLComponent 问题出在HTMLComponent本身,禁用表单焦点不会影响它。

答案 6 :(得分:0)

您可以尝试使整个组件具有可聚焦性,这可能有助于以适当的方式滚动。除此之外,你应该在表格的Boderlayout.center中添加你的html组件,并使表单可滚动为true,循环焦点为false。

答案 7 :(得分: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的设备上。列表从buttom跳到顶部。我通过改变返回值解决了这个问题。我将值更改为600(从200)。这样可以减少采样次数并防止“跳跃”。

相关问题