Added in API level 1

ToggleButton


open class ToggleButton : CompoundButton
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Button
   ↳ android.widget.CompoundButton
   ↳ android.widget.ToggleButton

Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".

See the Toggle Buttons guide.

Summary

XML attributes
android:disabledAlpha The alpha to apply to the indicator when disabled.
android:textOff The text for the button when it is not checked.
android:textOn The text for the button when it is checked.
Inherited XML attributes
Inherited constants
Public constructors
ToggleButton(context: Context!)

ToggleButton(context: Context!, attrs: AttributeSet!)

ToggleButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

ToggleButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open CharSequence!

open Float

Returns the alpha value of the button when it is disabled

open CharSequence!

Returns the text for when the button is not in the checked state.

open CharSequence!

Returns the text for when the button is in the checked state.

open Unit

open Unit
setChecked(checked: Boolean)

open Unit

Sets the text for when the button is not in the checked state.

open Unit

Sets the text for when the button is in the checked state.

Protected methods
open Unit

open Unit

Inherited functions