I am creating a layout dynamically, I am using
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
to place my elements one below the other. But for my header, i am using a new layout
LinearLayout layout_header = new LinearLayout(this);
layout.setOrientation(LinearLayout.HORIZONTAL);
and adding this in the view of the LinearLayout layout. But in LinearLayout layout_header, i have two buttons and i want one of them to be in total left and the other in total right. But both are coming side by side, i tried to include padding/margins but didn work.
I also created a layout params for both the buttons and tried adding margins/gravity/padding individually, but still did not work.
Please help how to proceed to place these buttons at two separate corners.