Java android.widget Switch fields, constructors, methods, implement or subclass

Example usage for Java android.widget Switch fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.widget Switch.

The text is from its open source code.

Subclass

android.widget.Switch has subclasses.
Click this link to see all its subclasses.

Constructor

Switch(Context context)
Construct a new Switch with default styling.
Switch

Method

DrawablegetThumbDrawable()
Get the drawable used for the switch "thumb" - the piece that the user can physically touch and drag along the track.
DrawablegetTrackDrawable()
Get the drawable used for the track that the switch slides within.
booleanisChecked()
voidsetButtonDrawable(@DrawableRes int resId)
Sets a drawable as the compound button image given its resource identifier.
voidsetChecked(boolean checked)
voidsetOnCheckedChangeListener(@Nullable OnCheckedChangeListener listener)
Register a callback to be invoked when the checked state of this button changes.
voidsetTextOff(CharSequence textOff)
Sets the text displayed when the button is not in the checked state.
voidsetTextOn(CharSequence textOn)
Sets the text displayed when the button is in the checked state.
voidtoggle()