I am trying to add 9 buttons programmatically to a FrameLayout
but only the last one is shown.
The code below is for the first button and I am doing like that for all the other buttons, but with different coordinates.
I want to add each button with these exact coordinates.
Sorry for bad English ;)
FrameLayout.LayoutParams rel_btn = new FrameLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Button button1 = new Button(this);
button1.setBackgroundResource(R.drawable.empty);
rel_btn.width = screenWidth/4;
rel_btn.height = screenWidth/4;
rel_btn.leftMargin = screenWidth/8;
rel_btn.topMargin = screenHeight-1100;
button1.setLayoutParams(rel_btn);
rl.addView(button1);