Hi,
I am trying to add table row dynamically in to a table lay out,
But its showing bank.my code is
TableLayout tl = (TableLayout) findViewById(R.id.maintable);
TableRow tableRow=new TableRow (this);
// tableRow.setLayoutParams(new LayoutParams
(LayoutParams.WRAP_CONTENT,
// LayoutParams.WRAP_CONTENT));
//
// textView=new TextView(this);
// textView.setLayoutParams(new LayoutParams(75,35));
// textView.setText(exhibitData.getExhibitName());
// textView.setTextColor(Color.BLACK);
// textView.setBackgroundColor(Color.CYAN);
// checkBox= new CheckBox(this);
// checkBox.setLayoutParams(new LayoutParams(75,35));
// checkBox.setId(exhibitData.getCheckBoxID());
// tableRow.setOrientation(1);
// tableRow.setBackgroundColor(Color.YELLOW);
// tableRow.addView(textView,new TableLayout.LayoutParams(
// LayoutParams.WRAP_CONTENT,
// LayoutParams.WRAP_CONTENT));
// tableRow.addView(checkBox,new TableLayout.LayoutParams(
// LayoutParams.WRAP_CONTENT,
// LayoutParams.WRAP_CONTENT));
// layout.addView(tableRow,new TableLayout.LayoutParams(
// LayoutParams.WRAP_CONTENT,
// LayoutParams.WRAP_CONTENT));
//// list.add(exhibitData.getExhibitName());
//// list.add("CHECKBOX");
//// idList.add(exhibitData.getCheckBoxID());
// System.out.println(idList.size()+""+list.size());
// System.out.println(exhibitData.getExhibitName());
// System.out.println(exhibitData.getCheckBoxID());
// Create a TableRow and give it an ID
// TableLayout tr = new TableLayout(this);
// tr.setId(100);
// tr.setLayoutParams(new LayoutParams(
// LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT));
// tr.setBackgroundColor(Color.GRAY);
// // Create a TextView to house the name of the province
// TextView labelTV = new TextView(this);
// // labelTV.setId(200+current);
// labelTV.setText(exhibitData.getExhibitName());
// labelTV.setTextColor(Color.BLACK);
// labelTV.setLayoutParams(new LayoutParams(
// LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT));
// tr.addView(labelTV);
//
// // Create a TextView to house the value of the after-
tax income
// TextView valueTV = new TextView(this);
// // valueTV.setId(current);
// valueTV.setText("exhibitData.getCheckBoxID()");
// valueTV.setTextColor(Color.BLACK);
// valueTV.setLayoutParams(new LayoutParams(
// LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT));
// tr.addView(valueTV);
//
// // Add the TableRow to the TableLayout
// tl.addView(tr, new TableLayout.LayoutParams(
// LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT));
lay out xml
<TableLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1"
android:id="@+id/maintable" >
</TableLayout>
I am not getting what i am missing, Please any one help me to solve
this
Thank you,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---