how to display textview to right side in tablerow in android
i am developing an android app. i need to display textview at right side
in tablerow, below is the code i am using, what is wrong with this code???
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);
No comments:
Post a Comment