SpanLabel in Codename one with BoxLayout along the y axis does not span

SpanLabel in Codename one with BoxLayout along the y axis does not span

我需要一个接一个地显示标签列表,但有些标签可能位于多行。因此,我创建了一个沿 y 轴带有 BoxLayout 的可滚动容器,并尝试使用 SpanLabels,但它显示为普通标签。我错过了什么吗?

Form f = new Form("Span", BoxLayout.y()); 

f.add(new SpanLabel("Short"));
f.add(new SpanLabel("Not so short"));
f.add(new SpanLabel("Not so long as to line break"));
f.add(new SpanLabel("This should totally line break because it's getting to that length where it should have an effect"));
f.add(new SpanLabel("Short"));
f.add(new SpanLabel("Not so short"));
f.add(new SpanLabel("Not so long as to line break"));
f.add(new SpanLabel("This should totally line break because it's getting to that length where it should have an effect"));

f.show();     

So I created a scrollable container with BoxLayout along the y-axis and tried to use SpanLabels, but it appears as a normal label. Am I missing something?

这是不工作的关键。我调用了 container.setScrollable(true),这使得它可以在 x 和 y 方向滚动,所以尽管我使用了 SpanLabel,它仍然显示在一行上,因为它可以水平滚动。这个:

    this.container.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    this.container.setScrollableY(true);
    this.container.setScrollableX(false);

帮我修好了。