Code example for TableLayout

Methods: setOrientationaddView

0
	 * Init The Human Machine Interface 
	 * (position of buttons/textfield/inputtextfield)  
	 */ 
	private void initExerciseHMI() { 
		// Layout 
		contentLayout = new TableLayout(this);
		contentLayout.setOrientation(LinearLayout.VERTICAL);
		actionLayout = new TableRow(this);
		// Text component 
		tvQuestion = new TextView(this); //The value of the text view will be not init here
		// Input text component 
		etAnswer = new EditText(this);
		etAnswer.setSingleLine(true);
		etAnswer.setGravity(Gravity.CENTER);
		// button to next question 
		bCommand = new Button(this);
		bCommand.setText(BUTTONS_DEFAULT_VALUE);
		bCommand.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				validateAnswerHMI(); 
			} 
		}); 
		// little setpoint 
		tvLittleSetpoint = new TextView(this);
		tvLittleSetpoint.setText(LITTLE_SETPOINT);
		tvLittleSetpoint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
		// set positions 
		actionLayout.addView(etAnswer, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); // fill all the empty space in the line (after the placement of the button)
		actionLayout.addView(bCommand);
		contentLayout.addView(tvLittleSetpoint);
		contentLayout.addView(tvQuestion);
		contentLayout.addView(actionLayout);
		// set the content view 
		setContentView(contentLayout);
	} 
	 
	/**