Class ToggleButton

All Implemented Interfaces:
Drawable.Callback, ViewTreeObserver.OnPreDrawListener, Checkable, Checkable2

public class ToggleButton extends CompoundButton
A toggle button is a simple implementation of CompoundButton. This does not provide a button drawable by default, and should be only used for toggle buttons that have both an icon and text. You can set the icon via TextView.setCompoundDrawablesRelative(icyllis.modernui.graphics.drawable.Drawable, icyllis.modernui.graphics.drawable.Drawable, icyllis.modernui.graphics.drawable.Drawable, icyllis.modernui.graphics.drawable.Drawable) or CompoundButton.setButtonDrawable(icyllis.modernui.graphics.drawable.Drawable) and set the text via TextView.setText(CharSequence). You can also setTextOn(CharSequence) and setTextOff(CharSequence) so that the text is synchronized with the checked state.

For a toggle button with only an icon, use CheckableImageButton. If the icon is not needed, we recommend using Switch.

Since:
3.12