Code example for TableLayout

Methods: setOrientation

0
	 
	public Layout(Activity context, WindowManager windowManager)
	{ 
		this.context = context;
		this.view = new ScrollView(context);
		this.innerLayout = new TableLayout(context);
		this.windowManager = windowManager;
		 
		int rotation = windowManager.getDefaultDisplay().getRotation();
		int orientation = 0;
		 
		switch (rotation) {
			case 0: 
				orientation = TableLayout.VERTICAL;
			break; 
 
			default: 
				orientation = TableLayout.HORIZONTAL;
			break; 
		} 
		 
		this.innerLayout.setOrientation(orientation);
		this.view.addView(this.innerLayout);
	} 
 
	/** 
	 * @return the view 
Experience pair programming with AI  Get Codota for Java