2

我正在用一张桌子做一个应用程序。每行有 3 个文本视图,并且行是动态生成的。

一切正常,但是当行数超过 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);

}
4

0 回答 0