Code example for SeekBar

Methods: getProgresssetProgresssetOnSeekBarChangeListener, setKeyProgressIncrement, setMax, setPadding

0
			// add the text message view to the layout 
			linearLayout.addView(messageTextView);
		} 
 
		// create the seek bar and set the maximum and current value 
		this.preferenceSeekBar = new SeekBar(getContext());
		this.preferenceSeekBar.setOnSeekBarChangeListener(this);
		this.preferenceSeekBar.setMax(this.max);
		this.preferenceSeekBar.setProgress(Math.min(this.seekBarCurrentValue, this.max));
		this.preferenceSeekBar.setKeyProgressIncrement(this.increment);
		this.preferenceSeekBar.setPadding(0, 0, 0, 10);
		// add the seek bar to the layout 
		linearLayout.addView(this.preferenceSeekBar);
 
		// create the text view for the current value below the seek bar 
		this.currentValueTextView = new TextView(getContext());
		this.currentValueTextView.setText(getCurrentValueText(this.preferenceSeekBar.getProgress()));
		this.currentValueTextView.setGravity(Gravity.CENTER_HORIZONTAL);
		// add the current value text view to the layout 
		linearLayout.addView(this.currentValueTextView);
 
		return linearLayout;