Alright, I have searched for its solution But unable to find it. The Question is simple. There is a TableLayout
in Android, I am adding few Rows in it. In the Last Row, I am adding a button. Now, the problem is the size of the button is not constant. What I mean is that, it fills the column. If the above data takes longer width of the column, the width of the button, accordingly increases. I have tried LayoutParams
, setHeight
, setWidth
function too, but that didn't help me..
I would appreciate if someone would help me out.
TableLayout table=new TableLayout(this);
TableRow tableRow=new TableRow(this);
Button button=new Button(this);
TableRow.LayoutParams trParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
Button.setLayoutParams(trParams);
tableRow.AddView(button);
table.addView(tableRow);