新手 请教布局问题。
如果一个布局 通过XML读取以后,还能对这个布局进行更改么。。。。
如下代码报错:
protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); TableLayout tb = (TableLayout)findViewById(R.layout.selectcontact); TableRow mtb = new TableRow(this); Button button = new Button(this); button.setText("DynamicButton"); mtb.addView(button); tb.addView(mtb); this.setContentView(tb); }
protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.setContentView(R.layout.selectcontact); TableLayout tb = (TableLayout)findViewById(R.layout.selectcontact); TableRow mtb = new TableRow(this); Button button = new Button(this); button.setText("DynamicButton"); mtb.addView(button); tb.addView(mtb); }