Slider

Added in API level XE22

A Slider from which slider appearances can be drawn: Slider.Scroller, Slider.Determinate, Slider.Indeterminate, and Slider.GracePeriod.

A Slider instance is obtained by calling the from-method on a View. A new slider appearance is drawn from this instance with the corresponding start-method. A pending show request on such a slider appearance is only honored as soon as the owning view has or gains focus. When the view loses focus, or another slider appearance is requested, the first slider appearance is hidden, and the client is responsible for requesting a re-show.

Although each slider appearance has its own state, there is only one global visual representation shared between all components on the device, even between users. This approach enables smooth transitions from one appearance into another. Each slider appearance is a widget, not a View, i.e. it cannot be inflated from a layout or added at a particular position in a view hierarchy.

Nested Classes
interface Slider.Determinate A determinate slider that tracks a position from left to right. 
interface Slider.GracePeriod A slider that animates from left to right during the given grace period in timeInMs and then dismisses itself after running the appropriate callback. 
interface Slider.Indeterminate An indeterminate slider that animates continuously to indicate ongoing but otherwise unknown progress. 
interface Slider.Scroller A scroll slider that indicates the current position within a fixed-size collection. 
Public Methods
static Slider
from(View view)
Slider.Determinate
startDeterminate(int maxPosition, float initialPosition)
Slider.GracePeriod
Slider.Indeterminate
Slider.Scroller
startScroller(int maxPosition, float initialPosition)
Inherited Methods

Public Methods

Added in API level XE22

public static Slider from (View view)

Constructs a Slider object from which different sliders can be drawn.

Drawing multiple slider appearances for the same view is done most efficiently by keeping a single Slider instance around. A Slider that fails to connect to the shared visual representation will only draw null sliders.

Parameters
view whose focus controls whether show requests are honored, cannot be null
Added in API level XE22

public Slider.Determinate startDeterminate (int maxPosition, float initialPosition)

Constructs and shows a determinate slider that tracks a position from left to right. Remains visible until hidden, or focus of the owning View is lost.

Parameters
maxPosition maximum position within slider
initialPosition initial position of slider
Returns
  • determinate slider
Added in API level XE22

public Slider.GracePeriod startGracePeriod (Slider.GracePeriod.Listener listener)

Constructs and shows a slider that animates from left to right during a default grace period and then dismisses itself. For a non-null listener, a proper callback on cancellation or completion is performed.

Parameters
listener for grace period's end or cancellation, may be null
Returns
  • grace period slider
Added in API level XE22

public Slider.Indeterminate startIndeterminate ()

Constructs and shows an indeterminate slider that animates continuously to indicate ongoing but otherwise unknown progress. Remains visible until hidden, or focus of the owning View is lost.

Returns
  • indeterminate slider
Added in API level XE22

public Slider.Scroller startScroller (int maxPosition, float initialPosition)

Constructs and shows a scroller slider that indicates the current position within a fixed-size collection. The slider hides automatically after a short time of inactivity.

Parameters
maxPosition maximum position within slider
initialPosition initial position of slider
Returns
  • scroller slider