Code example for LinearLayout.LayoutParams

Methods: setMargins

	private TableLayout addTable(String name, String brand, String caption, String type, String counter){
		TableLayout table = new TableLayout(this);
	    //Setting table parameters 
	    LinearLayout.LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	    layoutParams.setMargins(0, 5, 0, 5);
	    //Create a new row to be added. 
	    TableRow tr1 = new TableRow(this);
	    tr1.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
	    //Create the textView for name 
	    TextView textView1 = new TextView(this);
	    textView1.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	    textView1.setText("Name: " + name);
	    //Add textView to tableRow 
Connect your IDE to all the code out there  Get Codota for Java