TableLayout を動的に構築しています。そして、TableRow には特定の列位置にギャップがある必要があります。
たとえば、行には ImageView が 3 と 5 の位置にあり、次の行には ImageView が 1、2、4 の位置にある必要があります。私は使用しようとします:
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
任意の提案をいただければ幸いです。
ありがとうございました。