Android 12 Developer Preview is here! Try it out, and give us your feedback!

AppCompatButton

open class AppCompatButton : Button, TintableBackgroundView, AutoSizeableTextView, TintableCompoundDrawablesView
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:

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>(@NonNull context: Context)

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?)

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int)

Public methods
open Unit

open Unit

open Unit
setBackgroundDrawable(@Nullable background: Drawable?)

open Unit
setBackgroundResource(@DrawableRes resId: Int)

open Unit

See TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)

open Unit

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

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

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

Protected methods
open Unit

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

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

Public constructors

<init>

AppCompatButton(@NonNull context: Context)

<init>

AppCompatButton(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?)

<init>

AppCompatButton(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?,
    defStyleAttr: Int)

Public methods

onInitializeAccessibilityEvent

open fun onInitializeAccessibilityEvent(