当我单击按钮以将新按钮添加到框架布局时,新按钮会堆叠在一起。知道我做错了什么吗?
public void onClick(View v) {
Button newAlarm = new Button(Hop_Timer.this);
newAlarm.setText(alarmMinutes.getText() + " Addition - Remove");
newAlarm.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
FrameLayout alarmsFrame = (FrameLayout) findViewById(R.id.display_alarms);
alarmsFrame.addView(newAlarm);
}