Monday 15 September 2014

android - TextView Filling entire row programically -


In my code I make the rows dynamic, for some rows, I fill the whole line with TextView is required instead of the first cell, i.e.:

  -------------------- | Welcome | ------------------ | | Cell 1 Cell 2 Cell 3 | ------------------ | | Cell 1 Cell 2 Cell 3 --------------------   

My code:

  Tablewise welcome_OR = New tabler ( GetBaseContext ()); TextView welcome = new text view (getBaseContext ()); Welcome.setText ("Welcome"); Table.addView (welcome_row, new table layout, layoutperms (see group layoutperms.wrap_CONTENT, view grouping layoutParamusWRAP_CONTENT));   

How do I fill out the welcome Textview whole line?

try it

  public class increases main activity activity { @ Override Protected Zero (bundled Instantstate) {super.onCreate (savedInstanceState); Table layout table layout = new table layout (this); TableLayout.setLayoutParams (New LayerPrint (LayoutsPrint.match_PARENT, Layout Parameters.machch_PARENT)); TableRow welcome_row = New Tablerote (this); Welcome_row.setLayoutParams (new layoutprimm (layoutproduct.match_PARENT, paragraph layoutWRAP_CONTENT)); Welcome_row.setGravity (Gravity.CENTER); Welcome_row.setBackgroundColor (Color.GRAY); TextView welcome = new text view (this); Welcome.setText ("Welcome!"); Welcome.setBackgroundColor (Color.GREEN); // Add textview to welcome_row.addView (welcome) in the table row; // Add table row to table table- LAYOUT.addView (welcome_row); SetContentView (tableLayout); }}    

No comments:

Post a Comment