Dynmically added row in TableLayout
Posted
by Balaji
on Stack Overflow
See other posts from Stack Overflow
or by Balaji
Published on 2010-05-18T12:08:17Z
Indexed on
2010/05/18
12:10 UTC
Read the original article
Hit count: 418
android
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
© Stack Overflow or respective owner