Code example for LinearLayout

Methods: addView, setLayoutParams, setPadding

0
	} 
 
	@Override 
	protected void onPrepareDialogBuilder(Builder builder) {
		// we "have" to create new views each time 
		LinearLayout layout = new LinearLayout(mContext);
		layout.setLayoutParams(new LinearLayout.LayoutParams(
				LinearLayout.LayoutParams.FILL_PARENT,
				LinearLayout.LayoutParams.WRAP_CONTENT));
		// layout.setMinimumWidth(400); 
		layout.setPadding(20, 20, 20, 20);
 
		mSeekBar = new SeekBar(mContext);
		mSeekBar.setLayoutParams(new ViewGroup.LayoutParams(
				ViewGroup.LayoutParams.FILL_PARENT,
				ViewGroup.LayoutParams.WRAP_CONTENT));
 
		mSeekBar.setMax(mStartMax);
		mSeekBar.setProgress(mStartProgress);
		layout.addView(mSeekBar);
 
		builder.setView(layout);
		super.onPrepareDialogBuilder(builder);
	}