How to define the layout column of the view in the code (the view is in the tablerow)?


I have a tablelayout in xml. I am also adding some rows to it in code. How can i set some view's column_layout in code?

In xml i have:


How to achieve the same in code (e.g. for TextView)?

        TextView tv = new TextView(this);
        tv.setLayoutParams(new TableRow.LayoutParams(3));