AppCompatImageView
open class AppCompatImageView : ImageView, TintableBackgroundView, TintableImageSourceView
kotlin.Any | |||
↳ | android.view.View | ||
↳ | android.widget.ImageView | ||
↳ | androidx.appcompat.widget.AppCompatImageView |
A ImageView
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
androidx.appcompat.R.attr#backgroundTint
andandroidx.appcompat.R.attr#backgroundTintMode
. - Allows dynamic tint of its image via the image tint methods in
ImageViewCompat
. - Allows setting of the image tint using
androidx.appcompat.R.attr#tint
andandroidx.appcompat.R.attr#tintMode
.
This will automatically be used when you use ImageView
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, @Nullable attrs: AttributeSet?) |
|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int) |
Public methods | |
---|---|
open Boolean | |
open Unit |
setBackgroundDrawable(@Nullable background: Drawable?) |
open Unit |
setBackgroundResource(@DrawableRes resId: Int) |
open Unit |
setImageBitmap(bm: Bitmap!) |
open Unit |
setImageDrawable(@Nullable drawable: Drawable?) |
open Unit |
setImageResource(@DrawableRes resId: Int) Sets a drawable as the content of this ImageView. |
open Unit |
setImageURI(@Nullable uri: Uri?) |
Protected methods | |
---|---|
open Unit |
Public constructors
<init>
AppCompatImageView(@NonNull context: Context)
<init>
AppCompatImageView(
@NonNull context: Context,
@Nullable attrs: AttributeSet?)
<init>
AppCompatImageView(
@NonNull context: Context,
@Nullable attrs: AttributeSet?,
defStyleAttr: Int)
Public methods
hasOverlappingRendering
open fun hasOverlappingRendering(): Boolean
setImageResource
open fun setImageResource(@DrawableRes resId: Int): Unit
Sets a drawable as the content of this ImageView.
Allows the use of vector drawables when running on older versions of the platform.
Parameters | |
---|---|
resId |
Int: the resource identifier of the drawable |
See Also
Protected methods
drawableStateChanged
protected open fun drawableStateChanged(): Unit