spanlabel组件不会显示所有文本

问题描述 投票:1回答:1

我正在尝试使用SpanLabel显示文本,但是如果出现换行符,此组件将不会显示所有文本。然后,我尝试使用TextArea和Label UIID,但是结果是相同的。有人可以帮我解决这个问题吗?谢谢

codenameone
1个回答
0
投票

我在这里遇到同样的问题。我在对话框中使用SpanLabel,并且最后一两行始终会被截断。

仅在使用setPreferredW属性时会发生:

 spanLabelDialog.setPreferredW(Display.getInstance().getDisplayWidth()-300);

这是故意的吗?

以某种方式setMargin属性不适用于该对话框,无论是硬编码还是CSS中都没有。

这是我的代码:

private void dialolg () {

    String longText = "'There should be the whole text displayed here, but it seems the last one or two lines always get cut off'";

    spanLabelDialog.setText(longText);
    dialogExplain.add(BorderLayout.CENTER, spanLabelDialog);

    spanLabelDialog.setUIID("SpanLabelDialog");
    spanLabelDialog.setTextUIID("SpanLabelDialog");

    spanLabelDialog.setPreferredW(Display.getInstance().getDisplayWidth()-300);

    dialogExplain.show();

}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.