Define column in android tableLayout in java code
-
12-12-2019 - |
Question
I am using tablelayout in java file with 7 row and 7 column. In the first row i have three button which i want to place in 2nd, 4th and 6th column. The third button will span the column with 7th column. How can i define the column in java file and span the column. Next 6 row and 7 column contain 42 buttons.
Solution
You should be able to use column
and span
.
TableRow.LayoutParams trParam = new TableRow.LayoutParams();
trParam.column= 6
trParam.span = 5;
TableRow row = new TableRow(this);
TextView content = new TextView(this);
content.setLayoutParams(trParam);
content.addView(title);
I learned this from here if you want further info on TableLayouts.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow