tags:

views:

19

answers:

0

This is my activity class i want to add one textview to TableRow but i cannot show the textview in TableLayout.

Activity

import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.ViewGroup.LayoutParams; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.LinearLayout;

public class TableRunTime extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TableLayout tl = (TableLayout) findViewById(R.id.arcitle_content_table); TextView txt = new TextView(this); TableRow tr = new TableRow(this); txt.setText("Book Name"); txt.setTextColor(Color.WHITE); txt.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); tr.addView(txt); tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } }

This is manifest file

any one help how to show textview in TableLayout