我正在动态构建TableLayout.而且我需要TableRow在某些列位置有一个缺口.
例如,我需要在3和5位置上有行ImageView,下一行在1,2,4位置有ImageView.我尝试使用:
@H_502_8@ TableRow row1 = new TableRow(this); row1.addView(new ImageView(this),2); row1.addView(new ImageView(this),4); mTable.addView(row1); TableRow row2 = new TableRow(this); row2.addView(new ImageView(this),0); row2.addView(new ImageView(this),1); row2.addView(new ImageView(this),3); mTable.addView(row2);
但我在运行时得到了IndexOfBoundException.
ERROR / AndroidRuntime(771):引起:java.lang.IndexOutOfBoundsException:index = 2 count = 0
任何建议,将不胜感激.
谢谢.
最佳答案