0
当我点击我的按钮来添加新的按钮到framelayout时,新的按钮堆叠在一起。任何想法我做错了什么?当生成新的视图时,它们堆叠在一起
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);
}
这很好,非常感谢! – OFlan 2011-02-24 21:48:29