Reputation: 3912
I am able to easily place a horizontal line programmatically.
View view2 = new View(this);
view2.setBackgroundColor(0xFFC2BEBF);
relativelayout.addView(view2, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 2));
I now cannot find a solution to make a similar line except make it vertical. Again, this needs to be done all programmaticallly. I found a solution here but the code they provided did not work for me. The code supplied in the link can be found below.
view v = new View(this);
v.setLayoutParams(2,new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT));
It is so simple to make the horizontal line. How can I get my vertical line to work?
Upvotes: 0
Views: 2174
Reputation: 1347
Try This:
relativelayout.addView(view2, new ViewGroup.LayoutParams(2,ViewGroup.LayoutParams.MATCH_PARENT));
Upvotes: 2