TableLayout addView - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TableLayout addView method.

This code example shows how to use the following methods:setTag, addView, setColumnShrinkable, setColumnStretchable
        ViewWrapper wrap=null;
        View row=convertView;
 
        if (convertView==null) {
                         
            TableLayout layout = new TableLayout(ctxt);
            layout.setColumnStretchable(0, true);
            layout.setColumnShrinkable(0, true);
             
            TableRow tableRow = new TableRow(ctxt);           
            View guts=delegate.getView(position, null, parent);        
            CheckBox cb=new CheckBox(ctxt);
             
            cb.setLayoutParams(new TableRow.LayoutParams(
                    TableRow.LayoutParams.WRAP_CONTENT,
                    TableRow.LayoutParams.WRAP_CONTENT));
            guts.setLayoutParams(new TableRow.LayoutParams(
                    TableRow.LayoutParams.FILL_PARENT,
                    TableRow.LayoutParams.FILL_PARENT));
 

6
CodeRank
This code example shows how to use the following methods:setLayoutParams, setGravity, setOrientation, addView
		super.onCreate(savedInstanceState);
		loadViews(); 
	} 
 
	private void loadViews() { 
		Container = new TableLayout(this.getBaseContext());
		Container.setOrientation(TableLayout.VERTICAL);
		TableLayout.LayoutParams tl =
				new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,
						LayoutParams.FILL_PARENT);
		Container.setLayoutParams(tl);
		Container.setGravity(Gravity.CENTER_HORIZONTAL);
 
		TipsContainer = new LinearLayout(this.getBaseContext());
		TipsContainer.setOrientation(LinearLayout.VERTICAL);
		LinearLayout.LayoutParams lp = 
				new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
						LayoutParams.WRAP_CONTENT);
		lp.gravity = Gravity.CENTER_HORIZONTAL;
		TipsContainer.setGravity(Gravity.CENTER_HORIZONTAL);

6
CodeRank
This code example shows how to use the following methods:setLayoutParams, setOrientation, addView, setShrinkAllColumns, setStretchAllColumns
		super.onCreate(savedInstanceState);
		bv = new BackgroundView(this);
		 
		duel = new Duel("P1", "P2");
		 
		layout = new TableLayout(this);
		frame = new FrameLayout(this);
				 
		layout.setOrientation(TableLayout.VERTICAL);
		layout.setShrinkAllColumns(false);
		layout.setStretchAllColumns(true);
		//frame.setLayoutParams(new FrameLayout.LayoutParams(GameRules.getScreenWidth(), FrameLayout.LayoutParams.FILL_PARENT)); 
		layout.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.FILL_PARENT));
 
		 
		TableRow round = new TableRow(this);
		TextView roundLbl = new TextView(this);
		roundLbl.setPadding(10, 5, 0, 20);
		roundLbl.setText("Round " + duel.getRound());
		round.addView(roundLbl);

6
CodeRank
This code example shows how to use the following methods:setLayoutParams, addView, setStretchAllColumns
 
public class TableActibvity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        TableLayout tableLayout = new TableLayout(this);
        tableLayout.setLayoutParams(new TableLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT
        )); 
        tableLayout.setStretchAllColumns(true);
 
        TextView textView1 = new TextView(this);
        textView1.setText("Column 1");
        TextView textView2 = new TextView(this);
        textView2.setText("Column 2");
        TextView textView3 = new TextView(this);
        textView3.setText("Column 3");
 
        TextView textView4 = new TextView(this);

6
CodeRank
This code example shows how to use the following methods:setLayoutParams, addView, setColumnStretchable
	@Override 
	protected void onCreate(Bundle icicle) {
		super.onCreate(icicle);
 
		// Cria o layout 
		TableLayout tabela = new TableLayout(this);
		tabela.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		// Expande a coluna 1 
		tabela.setColumnStretchable(1, true);
 
		// Linha 1 
		TableRow linha1 = new TableRow(this);
 
		TextView nome = new TextView(this);
		nome.setText("Nome:");
		linha1.addView(nome);
 
		EditText tnome = new EditText(this);
		// Focus no campo nome 
		tnome.requestFocus();

6
CodeRank
This code example shows how to use the following methods:setLayoutParams, addView, setColumnStretchable
 
	createTableLayout(); 
    } 
 
    private void createTableLayout() { 
	TableLayout tableLayout = new TableLayout(this);
	tableLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
		LayoutParams.FILL_PARENT));
	tableLayout.setColumnStretchable(1, true);
 
	// Linha 1 
	TableRow row1 = new TableRow(this);
 
	TextView nomeTextView = new TextView(this);
	nomeTextView.setText("Nome:");
	row1.addView(nomeTextView);
 
	EditText nomeEditText = new EditText(this);
	nomeEditText.requestFocus();
	row1.addView(nomeEditText);

6
CodeRank
This code example shows how to use the following methods:setBackgroundColor, addView
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			text = extras.getString("text");
		} 
 
		TableLayout tableLayout = new TableLayout(this);
		tableLayout.setBackgroundColor(Color.rgb(255, 255, 255));
		setContentView(tableLayout, new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
 
		TableRow tableRow1 = new TableRow(this);
		shopName = new EditText(this);
		shopName.setText("", EditText.BufferType.NORMAL);
		tableRow1.addView(shopName);
 
		TableRow tableRow2 = new TableRow(this);
		RadioButton rd0 = new RadioButton(this);
		rd0.setId(0);
		rd0.setText("�����N�P");
		rd0.setTextColor(Color.rgb(0, 0, 0));

5
CodeRank
This code example shows how to use the following methods:setGravity, addView
        TextView surnamelabel = new TextView(this);
        surnamelabel.setText("Surname :   ");
        EditText surname = new EditText(this);
        surname.setText("                                       ");
        
        TableLayout tl = new TableLayout(this);	//Creo la tabella composta dalla due rigne che seguono ognuna delle quali ha due colonne come campi
         
        TableRow tr1 = new TableRow (this);		//Creo una riga della tabella in cui inserisco una textview e un edittext
        tr1.addView(namelabel);
        tr1.addView(name);
         
        TableRow tr2 = new TableRow(this);		//Creo una riga della tabella in cui inserisco una textview e un edittext
        tr2.addView(surnamelabel);
        tr2.addView(surname);
         
        tl.addView(tr1);
        tl.addView(tr2);
        tl.setGravity(Gravity.CENTER_VERTICAL);
         
        Button save = new Button(this);

5
CodeRank
This code example shows how to use the following methods:setGravity, setOrientation, addView
This code example shows how to use the following methods:addView
		// De Views der har et ID bliver gemt i onSaveInstanceState() 
		// og genskabt i onRestoreInstanceState(). 
		// I XML-layout-filer sættes attributten ID med f.eks. android:id="@+id/navn" 
		et2.setId(1000042); // bare et eller andet
 
		TableLayout tl = new TableLayout(this);
		tl.addView(tv);
		tl.addView(et1);
		tl.addView(et2);
		setContentView(tl);
	} 
 
	@Override 
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		// her genskabes indhold for alle views med id 
		super.onRestoreInstanceState(savedInstanceState);
		// data.navn = savedInstanceState.getString("navn"); 
	} 
 
	@Override 
5
CodeRank

Related TableLayout addView Questions & Answers:

addView Method Overview
Adds a child view.
See Code Examples for other Android TableLayout Methods: