1LinearLayout ll = new LinearLayout(this);
2ll.setOrientation(LinearLayout.VERTICAL);
3
4LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
5 LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
6
7layoutParams.setMargins(30, 20, 30, 0);
8
9Button okButton=new Button(this);
10okButton.setText("some text");
11ll.addView(okButton, layoutParams);
12