1
votes

enter image description here

In above image, one of the column has textArea with 2 line. So the row takes the height of it. Now i want to keep all the single line textarea in center vertically as well.Found out that setVerticalAlignment & so on methods only applies to single line textArea. How can i vertically align the textArea in center?

My code:

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 styling:

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

1 Answers

0
votes

You can't.

The workaround is to either wrap the TextArea in a Container to center it or use the align/valign constraints of the TableLayout.