在上图中,其中一列的textArea为2行 . 因此该行占据了它的高度 . 现在我想将所有单行textarea保持在垂直中心 . 发现setVerticalAlignment等方法仅适用于单行textArea . 如何将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);
textArea样式:
public void tableTextAreaStyle(TextArea textAreaName) {
textAreaName.setUIID(textAreaName.getText());
textAreaName.setEditable(false);
textAreaName.setGrowByContent(true);
textAreaName.setGrowLimit(2);
}