I try to add buttons to the linear layout programmatically .Buttons are added successfully to the linearlayout but between buttons some space is there. I need to remove the space between the buttons how to do this??
I use the following code,but I didn't able to remove the space between the views:
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 0, 0, 0);
Button okButton = new Button(this);
okButton.setText("some text");
ll.addView(okButton, layoutParams);
LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams1.setMargins(0, 0, 0, 0);
Button okButton1 = new Button(this);
okButton1.setText("some text");
ll.addView(okButton1, layoutParams1);
setContentView(ll);