layout = new LinearLayout(this);
addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button btn =
orientation of your linear layout must be horizontal. change it to vertical
Enjoy buddy
layout = new LinearLayout(this);
layout.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
layout.setOrientation(LinearLayout.VERTICAL);
setContentView(layout);
layout.setOrientation(LinearLayout.VERTICAL);
Reome this addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
You have not set Oreientation , Default is Horizontal, and you have given width LayoutParams.FILL_PARENT
layout = new LinearLayout(this);
layout .setOrientation(LinearLayout.VERTICAL); // orientation vertical try this
addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button btn = new Button(this);
btn.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
btn.setText("button");
layout.addView(btn);
Button btn1 = new Button(this);
btn1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
btn1.setText("button");
layout.addView(btn1);