addViewListBtn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
ListView list = new ListView(MainActivity.this);
ListViewMake listViewMake = new ListViewMake(1,list, MainActivity.this,
addListViewText1.getText().toString().trim(),addListViewText2.getText().toString().trim());
TableRow tableRow = new TableRow(MainActivity.this);
tableRow.addView(list);
bigTableLayout.addView(tableRow);
}});
removeViewListBtn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
int count = bigTableLayout.getChildCount();
if (count - 9 > 0) {
bigTableLayout.removeViewAt(count - 1);
}
}});
就是这样用addView()和removeViewAt();
remove的时候先用getChildCount()看一下有几个儿子,比较安全