Codenameone spancode name one中沿y轴具有BoxLayout的标签不跨

Codenameone spancode name one中沿y轴具有BoxLayout的标签不跨,codenameone,Codenameone,我需要在一个标签下显示一个标签列表,但有些标签可能在多行上。因此,我创建了一个沿y轴带有BoxLayout的可滚动容器,并尝试使用它,但它显示为普通标签。我错过什么了吗 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"))

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

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

因此,我创建了一个沿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();     
这是不起作用的关键。我调用了container.setScrollable(true),这使得它可以在x和y方向上滚动,所以尽管我使用了SpanLabel,它仍然显示在一行上,因为它可以水平滚动。这:

    this.container.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    this.container.setScrollableY(true);
    this.container.setScrollableX(false);
帮我修好了

因此,我创建了一个沿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();     
这是不起作用的关键。我调用了container.setScrollable(true),这使得它可以在x和y方向上滚动,所以尽管我使用了SpanLabel,它仍然显示在一行上,因为它可以水平滚动。这:

    this.container.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    this.container.setScrollableY(true);
    this.container.setScrollableX(false);
帮我修好了