楼主先试试addView一定要用带两个参数的函数,也就是改两句:
TableRow.LayoutParams lp = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
tablerow.addView(blocks[row][column], lp);
........map.addView(tablerow,new TableLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));如果还是不行,对所有控件先不要setLayoutParams(),而是在addView(),第二个参数的设置为指定的高度和宽度,例如:
tablerow.addView(blocks[row][column], new LayoutParams(10, 10));.....map.addView(tablerow,new TableLayout.LayoutParams(100,10));
注意:addView一定要用带两个参数的函数
TableRow.LayoutParams lp = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
tablerow.addView(blocks[row][column], lp);
........map.addView(tablerow,new TableLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));如果还是不行,对所有控件先不要setLayoutParams(),而是在addView(),第二个参数的设置为指定的高度和宽度,例如:
tablerow.addView(blocks[row][column], new LayoutParams(10, 10));.....map.addView(tablerow,new TableLayout.LayoutParams(100,10));
注意:addView一定要用带两个参数的函数
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货