AppCompatButton

open class AppCompatButton : Button, TintableBackgroundView, AutoSizeableTextView
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Button
   ↳ androidx.appcompat.widget.AppCompatButton

A Button which supports compatible features on older versions of the platform, including:

  • Allows dynamic tint of its background via the background tint methods in androidx.core.view.ViewCompat.
  • Allows setting of the background tint using R.attr#backgroundTint and R.attr#backgroundTintMode.

This will automatically be used when you use Button in your layouts and the top-level activity / dialog is provided by appcompat. You should only need to manually use this class when writing custom views.

Summary

Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods
open Unit
setBackgroundResource(@DrawableRes resId: Int)

open Unit

open Unit

Sets the properties of this field to transform input to ALL CAPS display.

open Unit
setTextAppearance(context: Context!, resId: Int)

open Unit

See TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)

open Unit

open Unit
setTextSize(unit: Int, size: Float)

open Unit

Protected methods
open Unit

open Unit
onTextChanged(text: CharSequence!, start: Int, lengthBefore: Int, lengthAfter: Int)

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

Public constructors

<init>

AppCompatButton(context: Context!)

<init>

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

<init>

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

Public methods

setBackgroundResource

open fun setBackgroundResource(@DrawableRes resId: Int): Unit

onInitializeAccessibilityNodeInfo

open fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo!): Unit

setSupportAllCaps

open fun setSupportAllCaps(allCaps: Boolean): Unit

Sets the properties of this field to transform input to ALL CAPS display. This may use a "small caps" formatting if available. This setting will be ignored if this field is editable or selectable. This call replaces the current transformation method. Disabling this will not necessarily restore the previous behavior from before this was enabled.

setTextAppearance

open fun setTextAppearance(context: Context!, resId: Int): Unit

setCustomSelectionActionModeCallback

open fun setCustomSelectionActionModeCallback(actionModeCallback: Callback!): Unit

See TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)

setBackgroundDrawable

open fun setBackgroundDrawable(background: Drawable!): Unit

setTextSize

open fun setTextSize(unit: Int, size: Float): Unit

onInitializeAccessibilityEvent

open fun onInitializeAccessibilityEvent(event: AccessibilityEvent!): Unit

Protected methods

drawableStateChanged

protected open fun drawableStateChanged(): Unit

onTextChanged

protected open fun onTextChanged(text: CharSequence!, start: Int, lengthBefore: Int, lengthAfter: Int): Unit

onLayout

protected open fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit