这行代码导致错误。这是我在参考此链接后所了解的
int c=4;LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT); //this is causing the errortl.setStretchAllColumns(true);
您需要将其更改为
TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);



