Added in API level 1

CompoundButton


abstract class CompoundButton : Button, Checkable
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Button
   ↳ android.widget.CompoundButton

A button with two states, checked and unchecked. When the button is pressed or clicked, the state changes automatically.

XML attributes

See CompoundButton Attributes, Button, TextView Attributes, View Attributes

Summary

Nested classes
abstract

Interface definition for a callback to be invoked when the checked state of a compound button changed.

Inherited XML attributes
Inherited constants
Public constructors

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

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

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

Public methods
open Unit

Automatically fills the content of this view with the value.

open Unit

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Int

Describes the autofill type of this view, so an android.service.autofill.AutofillService can create the proper AutofillValue when autofilling the view.

open AutofillValue?

Gets the TextView's current text for AutoFill.

open Drawable?

open BlendMode?

open ColorStateList?

open PorterDuff.Mode?

open Int

Returns the left padding of the view, plus space for the left Drawable if any.

open Int

Returns the right padding of the view, plus space for the right Drawable if any.

open Boolean

open Unit

Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.

open Unit

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState.

open Parcelable?

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.

open Boolean

Call this view's OnClickListener, if it is defined.

open Unit

Sets a drawable as the compound button image.

open Unit

Sets a drawable as the compound button image given its resource identifier.

open Unit

Sets the button of this CompoundButton to the specified Icon.

open Unit

Specifies the blending mode used to apply the tint specified by setButtonTintList(android.content.res.ColorStateList)} to the button drawable.

open Unit

Applies a tint to the button drawable.

open Unit

Specifies the blending mode used to apply the tint specified by setButtonTintList(android.content.res.ColorStateList)} to the button drawable.

open Unit
setChecked(checked: Boolean)

Changes the checked state of this button.

open Unit

Register a callback to be invoked when the checked state of this button changes.

open Unit
setStateDescription(stateDescription: CharSequence?)

This function is called when an instance or subclass sets the state description.

open Unit

Change the checked state of the view to the inverse of its current state

Protected methods
open Unit

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

open IntArray!

Generate the new android.graphics.drawable.Drawable state for this view.

open Unit
onDraw(canvas: Canvas)

Implement this to do your drawing.

open Boolean

If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.

Inherited functions