Android APIs
public class

SeekBar

extends AbsSeekBar
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ProgressBar
       ↳ android.widget.AbsSeekBar
         ↳ android.widget.SeekBar

Class Overview

A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged.

Clients of the SeekBar can attach a SeekBar.OnSeekBarChangeListener to be notified of the user's actions.

Summary

Nested Classes
interface SeekBar.OnSeekBarChangeListener A callback that notifies clients when the progress level has been changed. 
XML Attributes
Attribute Name Related Method Description
android:thumb Draws the thumb on a seekbar. 
[Expand]
Inherited XML Attributes
From class android.widget.ProgressBar
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
SeekBar(Context context)
SeekBar(Context context, AttributeSet attrs)
SeekBar(Context context, AttributeSet attrs, int defStyleAttr)
SeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void onInitializeAccessibilityEvent(AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener l)
Sets a listener to receive notifications of changes to the SeekBar's progress level.
[Expand]
Inherited Methods
From class android.widget.AbsSeekBar
From class android.widget.ProgressBar
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

XML Attributes

android:thumb

Draws the thumb on a seekbar.

Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

This corresponds to the global attribute resource symbol thumb.

Related Methods

Public Constructors

public SeekBar (Context context)

Added in API level 1

public SeekBar (Context context, AttributeSet attrs)

Added in API level 1

public SeekBar (Context context, AttributeSet attrs, int defStyleAttr)

Added in API level 1

public SeekBar (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public Methods

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

Added in API level 14

Initializes an AccessibilityEvent with information about this View which is the event source. In other words, the source of an accessibility event is the view whose state change triggered firing the event.

Example: Setting the password property of an event in addition to properties set by the super implementation:

 public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
     super.onInitializeAccessibilityEvent(event);
     event.setPassword(true);
 }

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityEvent(View, AccessibilityEvent) is responsible for handling this call.

Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.

Parameters
event The event to initialize.

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Added in API level 14

Initializes an AccessibilityNodeInfo with information about this view. The base implementation sets:

Subclasses should override this method, call the super implementation, and set additional attributes.

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo) is responsible for handling this call.

Parameters
info The instance to initialize.

public void setOnSeekBarChangeListener (SeekBar.OnSeekBarChangeListener l)

Added in API level 1

Sets a listener to receive notifications of changes to the SeekBar's progress level. Also provides notifications of when the user starts and stops a touch gesture within the SeekBar.

Parameters
l The seek bar notification listener