LWUIT 滚动点击问题
这是 LWUIT 提出的一个非常普遍的问题。
我正在为诺基亚 S40 手机进行开发。
我有一个充当菜单形式的列表。 Form
有一个 ActionListener
,它监听 SoftkeyEvents
以及 List
点击事件。
它是通过例如:
if (evt.getCommand() != null) {
if (evt.getCommand().getCommandName().equals("Back")) {
if (Display.getInstance().getCurrent().getUIID().equals("SubMenu")) {
和:
if (Display.getInstance().getCurrent().getUIID().equals("Menu") ) {
来做到这一点的问题是: 菜单似乎对滚动非常敏感,但对单击不够敏感。
意思是:如果您尝试单击列表中的菜单项,列表经常会滚动而不是实际捕获链接。
有什么方法可以影响这种行为吗?
this is a very general Question to LWUIT.
I'm developing for Nokia S40 phones.
I'm having a List in a form which functions as a Menu. The Form
has an ActionListener
which listens to SoftkeyEvents
and also the List
click events.
It's doing this by e.g.:
if (evt.getCommand() != null) {
if (evt.getCommand().getCommandName().equals("Back")) {
if (Display.getInstance().getCurrent().getUIID().equals("SubMenu")) {
and:
if (Display.getInstance().getCurrent().getUIID().equals("Menu") ) {
The problem is:
the menu seems to be hypersensitive to scrolling but not sensitive enough to clicking.
Means: If you try to click a menu entry in the List, the List very often scrolls instead of actually catching the link.
Is there some way to influence this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新答案:仅供参考,据我所知,我们有 S40 触摸手机,我们的 QA 没有报告这些问题。请记住,这是一个电阻屏幕,因此它无法处理手指,它最适合指甲,否则你会得到不好的结果。使用手指,您会在各处遇到拖动事件,这就是为什么您可能会遇到我在下面解释的情况。
您可能会看到这一点,因为 LWUIT 收到来自手机的 pointDragged 事件,因此决定拖动操作正在进行中。 LWUIT 实现中存在用于阻止指针拖动事件的一般经验值(以防止过于急切的平台发送过多的拖动事件)。如果平台发送“不适当的”拖动事件,LWUIT 将删除它们以避免混淆您的应用程序。
Display.setDragStartPercentage() 允许您调整手指需要移动以触发拖动的屏幕百分比。默认情况下,如果系统发送 7 个拖动事件,我们无论如何都会激活拖动,该选项只能由 LWUITImplementation 作者配置。
Updated answer: FYI We had S40 touch phones and our QA didn't report these issues as far as I recall. Keep in mind this is a resistive screen hence it can't handle fingers, it works best with the finger nail and you will get bad results otherwise. With the finger you will get drag events all over the place which is why you are probably experiencing what I explain bellow.
You are probably seeing this because LWUIT received pointerDragged events from the phone and hence made the decision that a drag operation is in progress. There are general rule of thumb values for pointer drag event blocking within LWUIT implementation (to prevent over eager platforms from sending too many drag events). If a platform sends "inappropriate" drag events LWUIT will just drop them to avoid confusing your application.
Display.setDragStartPercentage() allows you to tune the percentage of the screen that the finger needs to move in order to trigger a drag. By default if the system sends 7 drag events we activate the drag regardless, that option is only configurable to the LWUITImplementation authors.