First off all it's not a good idea setting layout programmatically.

Button button = new Button(this);
bt.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));