Android TableLayout - top ranked examples from Open Source projects

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

This code example shows how to use the following methods: isColumnCollapsed, setColumnCollapsed
 
	} 
 
	public void toggleHiddenRows(View view) {
		// Second row has index 1 
		layout.setColumnCollapsed(1, !layout.isColumnCollapsed(1));
		if (layout.isColumnCollapsed(1)) {
			button.setText("Show second column");
		} else { 
			button.setText("Hide second column");
		} 
	} 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: removeView
		return spinner.getSelectedItem().toString() + selectionExtra;
	} 
	 
	private void remove() { 
		if(parentView != null)
			parentView.removeView(this);
		if(tagsFragment != null)
			tagsFragment.tagEntries.remove(this);
	} 
	 
	private View.OnClickListener removeListener = new View.OnClickListener() {
		public void onClick(View v) { 
			remove(); 
		} 
	}; 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setColumnShrinkable
This code example shows how to use the following methods: setColumnStretchable
        final TableLayout table = (TableLayout) findViewById(R.id.menu);
        Button button = (Button) findViewById(R.id.toggle);
        button.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                mStretch = !mStretch;
                table.setColumnStretchable(1, mStretch);
            } 
        }); 
 
        mStretch = table.isColumnStretchable(1);
 
        appendRow(table);
    } 
 
    private void appendRow(TableLayout table) {
        TableRow row = new TableRow(this);
 
        TextView label = new TextView(this);
        label.setText(R.string.table_layout_8_quit);
        label.setPadding(3, 3, 3, 3);
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setColumnCollapsed
        }); 
        button = (Button) findViewById(R.id.toggle2);
        button.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                mCheckmarksCollapsed = !mCheckmarksCollapsed;
                table.setColumnCollapsed(0, mCheckmarksCollapsed);
            } 
        }); 
 
        mCheckmarksCollapsed = table.isColumnCollapsed(0);
        mShortcutsCollapsed = table.isColumnCollapsed(2);
 
        appendRow(table);
    } 
 
    private void appendRow(TableLayout table) {
        TableRow row = new TableRow(this);
 
        TextView label = new TextView(this);
        label.setText(R.string.table_layout_7_quit);
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android TableLayout Questions & Answers:

See Code Examples for Android TableLayout Methods: