为什么在我的 CN1 应用程序中滑动时,当我抬起手指时,我的侧边菜单会弹回?

Why does my Side menu snaps back when i lift my finger, when swiping in my CN1 app?

在我的 Codenameone 应用程序中,我构建了一个侧边菜单,但我有 2 个外观问题。

  1. 当我从左侧轻扫并在屏幕上抬起手指时 space,比菜单完成稍微远一点,菜单会弹回。如果我在 space 中抬起手指,它不会弹回,菜单将扩展到。有没有办法让侧边菜单在我滑动的时候留在屏幕上?
  2. 我的主页有一个垂直滚动的容器。当我打开侧面菜单时,它不会禁用我的主页,因此我仍然可以通过将手指移到菜单右侧的 space 上来滚动我的主页容器。我们是否可以在菜单打开时默认禁用主页内容?

作为参考,我的菜单是按照 this tutorial 设计的,一个非常简单的例子是:

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    hi.add(new Label("Hi World"));

    Toolbar t = new Toolbar();
    hi.setToolbar(t);
    t.setTitle("Title");
    Label logoLabel = new Label("");
    logoLabel.setTextPosition(Label.BOTTOM);
    logoLabel.setText("label text here");
    t.addComponentToSideMenu(logoLabel);

    hi.show();
}

谢谢

这里的关闭点似乎被硬编码到屏幕的四分之一:https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/ui/Toolbar.java#L1380

代码中可能还有其他点实现了这个逻辑。可以更改它以使该逻辑可通过主题常量进行配置。但是现在这是硬编码的。