0
私は2列のテーブルを動的に追加する必要があるアプリケーションを開発中です。以下は、私が使用していたコードは、これは私のJavaコードAndroidで動的にTableLayoutに行を追加する
TableLayout tb=(TableLayout)findViewById(R.id.table);
TableRow tr=new TableRow(getBaseContext());
Button b1=(Button)findViewById(R.id.b1);
LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
tr.setLayoutParams(lp);
b1.setLayoutParams(lp);
b1.setText("I NEED HELP ! SOS ");
tr.addView(b1);
tb.addView(tr,lp);