Code example for LinearLayout

Methods: addViewsetOrientation, setBackgroundColor, setLayoutParams, setPadding

0
		ImageView poweredByIV = new ImageView(context);
		InputStream in = ZendeskDialog.class.getResourceAsStream("/com/zendesk/zendesk.png");
		Bitmap poweredBy = BitmapFactory.decodeStream(in);
		poweredByIV.setImageBitmap(poweredBy);
 
		LinearLayout llButton = new LinearLayout(context);
		llButton.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
		llButton.setOrientation(LinearLayout.HORIZONTAL);
		llButton.setBackgroundColor(0xFFBDBDBD);
		llButton.setPadding(0, 4, 0, 0);
 
		Button submit = new Button(context);
		submit.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1));
		submit.setText("Submit Query");
		submit.setId(DialogInterface.BUTTON1);
		submit.setOnClickListener(buttonListener);
 
		Button cancel = new Button(context);
		cancel.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1));
		cancel.setText("Cancel");
		cancel.setId(DialogInterface.BUTTON2);
		cancel.setOnClickListener(buttonListener);
 
		llRoot.addView(sv);
		llRoot.addView(llButton);
 
		sv.addView(llContent);
 
		llContent.addView(llTop);
		llContent.addView(llBottom);
 
		llTop.addView(descriptionTV);
		llTop.addView(descriptionET);
		llTop.addView(subjectTV);
		llTop.addView(subjectET);
		llTop.addView(emailTV);
		llTop.addView(emailET);
 
		llBottom.addView(poweredByTV);
		llBottom.addView(poweredByIV);
 
		llButton.addView(submit);
		llButton.addView(cancel);
		return llRoot;
	} 
 
	private static void resetDialogView() { 
		descriptionET.setText("");