我正在开发一个安卓应用程序。我需要在tablerow的右侧显示textview,下面是我正在使用的代码,这段代码有什么问题???
ScrollView src;
src=(ScrollView)findViewById(R.id.scrollView1);
TableLayout t1=new TableLayout(context);
TableRow.LayoutParams tableRowParams=new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT,TableRow.LayoutParams.FILL_PARENT);
tableRowParams.gravity=Gravity.RIGHT | Gravity.CENTER_VERTICAL;
for(int i=0;i<count;i++)
{
TableRow tr=new TableRow(context);
TextView txt_peron_name=new TextView(context);
txt_peron_name.setTextColor(Color.BLACK);
txt_peron_name.setTextSize(15);
txt_peron_name.setText("Hello");
//txt_peron_name.setLayoutParams(tableRowParams);
tr.setBackgroundResource(R.drawable.cc1);
//tr.setLayoutParams(tableRowParams);
tr.addView(txt_peron_name);
t1.addView(tr,tableRowParams);
}// End of For Loop
src.removeAllViews();
src.addView(t1);