LWUIT滚动跳转问题

发布于 2024-11-04 01:06:34 字数 246 浏览 4 评论 0原文

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

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

有什么想法如何防止这种滚动问题?

I need to show the only component on the form - HTMLComponent. Reaching the bottom of the form/component while vertical scrolling scroll bar jumps back to the top of the form. I need to prevent this.

I've tried to turn on/off scrolling on the form and HTMLComponent but anyway if there's a scroll bar - it will return to the top from the bottom. Also I've tried border and box layouts and additional container for HTMLComponent - no use.

Any ideas how to prevent such scrolling issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

哑剧 2024-11-11 01:06:34

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

htmlComponent.getComponentForm().setCyclicFocus(false);

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

Try this (it works for me - LWUIT 1.5):

htmlComponent.getComponentForm().setCyclicFocus(false);

If you get a NullPointerException, call it after adding to the HtmlComponent to a form.

唠甜嗑 2024-11-11 01:06:34

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

form.setCyclicFocus(false)

If you want to get rid of the bottom/top jump scroll, you can use

form.setCyclicFocus(false)

黯然#的苍凉 2024-11-11 01:06:34

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

form.setScrollable(false);

You should stick with border layout and place the HTML component in the center for this particular use case. You can disable form scrolling since the HTML component is indeed scrollable by default:

form.setScrollable(false);
辞取 2024-11-11 01:06:34

HTMLComponent 本身是可滚动的,

以防止

setScrollable(false);

水平滚动的滚动

setScrollableX(false);

希望这能解决您的问题

HTMLComponent is itself scrollable

to prevent scrolling

setScrollable(false);

for horizontal scroll off

setScrollableX(false);

hope this will solve your issue

蔚蓝源自深海 2024-11-11 01:06:34

...或者,您可以将此代码粘贴到您的 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);
    }
}

这对我也有用

...or, you can paste this code on your Form class

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);
    }
}

That's also work for me

帅哥哥的热头脑 2024-11-11 01:06:34

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

form.serScrollable(false) or form.setCyclicFocus(false) didn't work for me.
I have a form and just a single HTMLComponent in it.
The problem is in HTMLComponent itself and disabling focus of the form won't affect it.

拥醉 2024-11-11 01:06:34

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

You can try with making the whole component focusable which might help in scrolling in a proper way. Along with this you should add your html component in Boderlayout.center of form and make form scrollable true and cyclic focus false.

尸血腥色 2024-11-11 01:06:34

在 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)。这会减少采样并防止“跳跃”。

In LWUITImplementation we have function getDragPathTime(). This javaDoc about this function:

 /**
 * 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
 */

I also was problem especially in devices with OS S-60 Nokia. Lists was jumped from buttom to top. i solved this problem by change the return value. I change the value to 600( from 200). this occurs to fewer sampling and prevent the "jump".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文