首页 > 代码库 > TableLayout 中不显示动态添加的tableRow

TableLayout 中不显示动态添加的tableRow

 

下面的代码不显示:

TableRow lay = new TableRow(layIndex.getContext());
lay.setLayoutParams(lpRow);
//layIndex.addView(lay, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));

 

下面的代码显示:

TableRow lay = new TableRow(layIndex.getContext());
//lay.setLayoutParams(lpRow);
layIndex.addView(lay, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));