我正在用桌子做一个应用程序。 每行有3个textview,动态生成行。
所有工作都很好但是当行超过15-20时我在logcat中看到此消息(大约3次):
09-24 15:48:37.307: I/dalvikvm(32685): threadid=3: reacting to signal 3
09-24 15:48:37.337: I/dalvikvm(32685): Wrote stack traces to '/data/anr/traces.txt'
(该表需要几秒钟才能显示,更多行有更多时间显示)。
是否有解决方案可以避免这个问题,或者大桌子是否正常?
这是生成表格的代码:
for (Esame e : Db.risposteDate){
TableRow tr = new TableRow(this);
TextView lbl1 = new TextView(this);
TextView lbl2 = new TextView(this);
TextView lbl3 = new TextView(this);
tr.setGravity(Gravity.CENTER);
lbl1.setGravity(Gravity.CENTER_VERTICAL);
lbl3.setGravity(Gravity.CENTER);
lbl1.setTextColor(android.graphics.Color.RED);
lbl2.setTextColor(android.graphics.Color.RED);
lbl3.setTextColor(android.graphics.Color.RED);
lbl1.setLayoutParams( new TableRow.LayoutParams( 0, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1 ) );
lbl2.setLayoutParams( new TableRow.LayoutParams( 0, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 7 ) );
lbl3.setLayoutParams( new TableRow.LayoutParams( 0, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1 ) );
lbl1.setText(e.getDomandaNum()+"");
lbl2.setText(Html.fromHtml(e.getTesto()+"<br />"));
lbl3.setText(e.getRispostaData());
tr.addView(lbl1);
tr.addView(lbl2);
tr.addView(lbl3);
tl.addView(tr);
}