表格布局中的多行文本区域对齐codenameone

表格布局中的多行文本区域对齐codenameone,codenameone,Codenameone,在上图中,其中一列的textArea有两行。所以这一排占据了它的高度。现在我想让所有单行textarea也垂直居中。我发现setVerticalAlignment&so方法只适用于单行textarea。如何在中心垂直对齐文本区域 我的代码: TableLayout tl = new TableLayout(1, 5); Container containerTableHeading = new Container(tl); TextArea tableName = new TextArea("T

在上图中,其中一列的textArea有两行。所以这一排占据了它的高度。现在我想让所有单行textarea也垂直居中。我发现setVerticalAlignment&so方法只适用于单行textarea。如何在中心垂直对齐文本区域

我的代码:

TableLayout tl = new TableLayout(1, 5);
Container containerTableHeading = new Container(tl);
TextArea tableName = new TextArea("Table Name");
tableTextAreaStyle(tableName);
TextArea inaugurationDate = new TextArea("Inauguration Date");
tableTextAreaStyle(inaugurationDate);
TextArea areaCode = new TextArea("Area Code");
tableTextAreaStyle(areaCode);
TextArea clubAbbrName = new TextArea("Club Abbr Name");
tableTextAreaStyle(clubAbbrName);
TextArea clubCharterDate = new TextArea("Club Charter Date");
tableTextAreaStyle(clubCharterDate);
containerTableHeading.add(tl.createConstraint().widthPercentage(30), tableName);
containerTableHeading.add(tl.createConstraint().widthPercentage(20), inaugurationDate);
containerTableHeading.add(tl.createConstraint().widthPercentage(15), areaCode);
containerTableHeading.add(tl.createConstraint().widthPercentage(15), clubAbbrName);
containerTableHeading.add(tl.createConstraint().widthPercentage(20), clubCharterDate);
文本区域样式:

public void tableTextAreaStyle(TextArea textAreaName) {
        textAreaName.setUIID(textAreaName.getText());
        textAreaName.setEditable(false);
        textAreaName.setGrowByContent(true);
        textAreaName.setGrowLimit(2);
    }
你不能

解决方法是将
文本区域
包装在
容器中
以使其居中,或者使用
表格布局

的/约束

解决方法是将
文本区域
包装在
容器中
使其居中,或者使用
表格布局
的/约束