I have gone through different examples but i unable to find the exact answer for my requirement. Below is my code. let me know where i went wrong.
TableLayout tableLayout = (TableLayout) findViewById(R.id.tableLayout);
TableRow tableRow = new TableRow(this);
TableLayout.LayoutParams params=
new TableLayout.LayoutParams
(TableLayout.LayoutParams.MATCH_PARENT,TableLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(20,20, 20, 5);
tableRow.setLayoutParams(params);
tableLayout.addView(tableRow, new TableLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
Thanks..,
When you make your call to
addViewyou create newLayoutParamsand according to the documentation aboutaddViewI think that you should send params in your
addViewcall instead of creating newLayoutParams