List of usage examples for android.widget TableRow getLayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_") public ViewGroup.LayoutParams getLayoutParams()
From source file:Main.java
/** * Add button to the layout as the left one on a row. * * @param act The running activity./*from www .jav a 2 s . c o m*/ * @param table The table of buttons. * @param lastRow The previous row of buttons. * @param actName Name of the activity. * @return The Button object that is constructed. */ private static Button addButtonAsFirst(Activity act, TableLayout table, TableRow lastRow, String actName) { /** * Create new row for the table. */ TableRow newRow = new TableRow(act); newRow.setLayoutParams(lastRow.getLayoutParams()); /** * Create both buttons. Set the second invisible. */ Button old = (Button) lastRow.getChildAt(0); Button left = new Button(act); left.setText(actName); left.setLayoutParams(old.getLayoutParams()); Button right = new Button(act); right.setText("TempButton"); right.setLayoutParams(old.getLayoutParams()); right.setVisibility(View.INVISIBLE); /** * Add them on. */ newRow.addView(left); newRow.addView(right); table.addView(newRow); return left; }