LWUIT滚动跳转问题
我需要显示表单上的唯一组件 - 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
试试这个(它对我有用 - LWUIT 1.5):
如果您收到
NullPointerException
,请在将HtmlComponent
添加到表单后调用它。Try this (it works for me - LWUIT 1.5):
If you get a
NullPointerException
, call it after adding to theHtmlComponent
to a form.如果你想摆脱底部/顶部的跳转滚动,可以使用
form.setCyclicFocus(false)
If you want to get rid of the bottom/top jump scroll, you can use
form.setCyclicFocus(false)
对于这个特定的用例,您应该坚持使用边框布局并将 HTML 组件放置在中心。您可以禁用表单滚动,因为 HTML 组件默认情况下确实是可滚动的:
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:
HTMLComponent 本身是可滚动的,
以防止
水平滚动的滚动
希望这能解决您的问题
HTMLComponent is itself scrollable
to prevent scrolling
for horizontal scroll off
hope this will solve your issue
...或者,您可以将此代码粘贴到您的 Form 类上
这对我也有用
...or, you can paste this code on your Form class
That's also work for me
form.serScrollable(false)
或form.setCyclicFocus(false)
对我不起作用。我有一个表单,其中只有一个
HTMLComponent
。问题出在
HTMLComponent
本身,禁用表单焦点不会影响它。form.serScrollable(false)
orform.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.您可以尝试使整个组件可聚焦,这可能有助于以正确的方式滚动。除此之外,您还应该在表单的 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.
在 LWUITImplementation 中,我们有函数 getDragPathTime()。关于此功能的 javaDoc:
我也遇到了问题,尤其是在具有 OS S-60 Nokia 操作系统的设备中。列表从底部跳到顶部。我通过更改返回值解决了这个问题。我将值更改为 600(从 200)。这会减少采样并防止“跳跃”。
In LWUITImplementation we have function getDragPathTime(). This javaDoc about this function:
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".