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));

原文地址:https://www.cnblogs.com/zmc/p/3840763.html