AppCompatImageButton

open class AppCompatImageButton : ImageButton, TintableBackgroundView, TintableImageSourceView
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.ImageView
   ↳ android.widget.ImageButton
   ↳ androidx.appcompat.widget.AppCompatImageButton

A ImageButton 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.
  • Allows dynamic tint of its image via the image tint methods in ImageViewCompat.
  • Allows setting of the image tint using R.attr#tint and R.attr#tintMode.

This will automatically be used when you use ImageButton 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 Boolean

open Unit

open Unit
setBackgroundResource(@DrawableRes resId: Int)

open Unit

open Unit
setImageDrawable(@Nullable drawable: Drawable?)

open Unit
setImageResource(@DrawableRes resId: Int)

open Unit
setImageURI(@Nullable uri: Uri?)

Protected methods

open Unit

Public constructors

<init>

AppCompatImageButton(context: Context!)

<init>

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

<init>

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

Public methods

hasOverlappingRendering

open fun hasOverlappingRendering(): Boolean

setBackgroundDrawable

open fun setBackgroundDrawable(background: Drawable!): Unit

setBackgroundResource

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

setImageBitmap

open fun setImageBitmap(bm: Bitmap!): Unit

setImageDrawable

open fun setImageDrawable(@Nullable drawable: Drawable?): Unit

setImageResource

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

setImageURI

open fun setImageURI(@Nullable uri: Uri?): Unit

Protected methods

drawableStateChanged

protected open fun drawableStateChanged(): Unit