Designing The Tablelayout Which Has To Be Added Dynamically Within A Relativelayout
I have to create an activity which has the layout as shown in the attached image. I am having problems with making it look close to as shown in the image. In the previous activity
Solution 1:
I think your textview
is taking all the space in the table row try setting layout params for that as well
For ex:
tv[i].setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3f));
And similarly for image button
delete_btns[i].setLayoutParams(new TableRow.LayoutParams(
0, LayoutParams.WRAP_CONTENT,1f));
And to table row
tr[i].setWeightSum(4f)
Here the third argument of float
type is weight of the view as it is set to 1f
for both your image view and textview both will occupy equal space you can change it and set it what you need.
While using weight set width to 0dp for both textview and imageview
EDIT
LayoutParams lp=new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT);
lp.weight=3f;
tv[i].setLayoutParams(lp);
Post a Comment for "Designing The Tablelayout Which Has To Be Added Dynamically Within A Relativelayout"