FileDocCategorySizeDatePackage
AddColumn.javaAPI DocAndroid 5.1 API1975Thu Mar 12 22:22:12 GMT 2015android.widget.layout.table

AddColumn

public class AddColumn extends android.app.Activity
This test adds an extra row with an extra column in the table.

Fields Summary
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);
        setContentView(R.layout.add_column_in_table);

        final Button addRowButton = (Button) findViewById(R.id.add_row_button);
        addRowButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                final TableLayout table = (TableLayout) findViewById(R.id.table);
                final TableRow newRow = new TableRow(AddColumn.this);
                for (int i = 0; i < 4; i++) {
                    final TextView view = new TextView(AddColumn.this);
                    view.setText("Column " + (i + 1));
                    view.setPadding(3, 3, 3, 3);
                    newRow.addView(view, new TableRow.LayoutParams());
                }
                table.addView(newRow, new TableLayout.LayoutParams());
                newRow.requestLayout();
            }
        });