Added in API level 1

CheckedTextView


open class CheckedTextView : TextView, Checkable
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.CheckedTextView

An extension to TextView that supports the Checkable interface and displays.

This is useful when used in a ListView where the setChoiceMode has been set to something other than CHOICE_MODE_NONE.

Summary

XML attributes
android:checkMark Drawable used for the check mark graphic.
android:checked Indicates the initial checked state of this text.
Inherited XML attributes
Inherited constants
Public constructors

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

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

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

Public methods
open Unit

open CharSequence!

open Drawable!

Gets the checkmark drawable

open BlendMode?

Returns the blending mode used to apply the tint to the check mark drawable, if specified.

open ColorStateList?

Returns the tint applied to the check mark drawable, if specified.

open PorterDuff.Mode?

Returns the blending mode used to apply the tint to the check mark drawable, if specified.

open Boolean

open Unit

open Unit

open Unit
onRtlPropertiesChanged(layoutDirection: Int)

open Parcelable?

open Unit

Sets the check mark to the drawable with the specified resource ID.

open Unit

Set the check mark to the specified drawable.

open Unit

Specifies the blending mode used to apply the tint specified by setCheckMarkTintList(android.content.res.ColorStateList) to the check mark drawable.

open Unit

Applies a tint to the check mark drawable.

open Unit

Specifies the blending mode used to apply the tint specified by setCheckMarkTintList(android.content.res.ColorStateList) to the check mark drawable.

open Unit
setChecked(checked: Boolean)

Sets the checked state of this view.

open Unit
setVisibility(visibility: Int)

open Unit

Protected methods
open Unit

open IntArray!

open Unit
onDraw(canvas: Canvas)

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
Inherited properties

XML attributes

android:checkMark

android:checkMark
Drawable used for the check mark graphic.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:checked

android:checked
Indicates the initial checked state of this text.

May be a boolean value, such as "true" or "false".

Public constructors

CheckedTextView

Added in API level 1
CheckedTextView(context: Context!)

CheckedTextView

Added in API level 1
CheckedTextView(
    context: Context!,
    attrs: AttributeSet!)

CheckedTextView

Added in API level 1
CheckedTextView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

CheckedTextView

Added in API level 21
CheckedTextView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

drawableHotspotChanged

Added in API level 21
open fun drawableHotspotChanged(
    x: Float,
    y: Float
): Unit
Parameters
x Float: hotspot x coordinate
y Float: hotspot y coordinate

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

getCheckMarkDrawable

Added in API level 16
open fun getCheckMarkDrawable(): Drawable!

Gets the checkmark drawable

Return
Drawable! The drawable use to represent the checkmark, if any.

getCheckMarkTintBlendMode

Added in API level 29
open fun getCheckMarkTintBlendMode(): BlendMode?

Returns the blending mode used to apply the tint to the check mark drawable, if specified.

Return
BlendMode? the blending mode used to apply the tint to the check mark drawable This value may be null.

getCheckMarkTintList

Added in API level 21
open fun getCheckMarkTintList(): ColorStateList?

Returns the tint applied to the check mark drawable, if specified.

Return
ColorStateList? the tint applied to the check mark drawable This value may be null.

getCheckMarkTintMode

Added in API level 21
open fun getCheckMarkTintMode(): PorterDuff.Mode?

Returns the blending mode used to apply the tint to the check mark drawable, if specified.

Return
PorterDuff.Mode? the blending mode used to apply the tint to the check mark drawable This value may be null.

isChecked

Added in API level 1
open fun isChecked(): Boolean
Return
Boolean The current checked state of the view

jumpDrawablesToCurrentState

Added in API level 11
open fun jumpDrawablesToCurrentState(): Unit

onRestoreInstanceState

Added in API level 1
open fun onRestoreInstanceState(state: Parcelable!): Unit
Parameters
state Parcelable!: The frozen state that had previously been returned by onSaveInstanceState.

onRtlPropertiesChanged

Added in API level 17
open fun onRtlPropertiesChanged(layoutDirection: Int): Unit
Parameters
layoutDirection Int: the direction of the layout Value is android.view.View#LAYOUT_DIRECTION_LTR, or android.view.View#LAYOUT_DIRECTION_RTL

onSaveInstanceState

Added in API level 1
open fun onSaveInstanceState(): Parcelable?
Return
Parcelable? Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save.

setCheckMarkDrawable

Added in API level 1
open fun setCheckMarkDrawable(resId: Int): Unit

Sets the check mark to the drawable with the specified resource ID.

When this view is checked, the drawable's state set will include android.R.attr#state_checked.

Parameters
resId Int: the resource identifier of drawable to use as the check mark

setCheckMarkDrawable

Added in API level 1
open fun setCheckMarkDrawable(d: Drawable?): Unit

Set the check mark to the specified drawable.

When this view is checked, the drawable's state set will include android.R.attr#state_checked.

Parameters
d Drawable?: the drawable to use for the check mark This value may be null.

setCheckMarkTintBlendMode

Added in API level 29
open fun setCheckMarkTintBlendMode(tintMode: BlendMode?): Unit

Specifies the blending mode used to apply the tint specified by setCheckMarkTintList(android.content.res.ColorStateList) to the check mark drawable. The default mode is PorterDuff.Mode#SRC_IN.

Parameters
tintMode BlendMode?: the blending mode used to apply the tint, may be null to clear tint

setCheckMarkTintList

Added in API level 21
open fun setCheckMarkTintList(tint: ColorStateList?): Unit

Applies a tint to the check mark drawable. Does not modify the current tint mode, which is PorterDuff.Mode#SRC_IN by default.

Subsequent calls to setCheckMarkDrawable(android.graphics.drawable.Drawable) will automatically mutate the drawable and apply the specified tint and tint mode using Drawable#setTintList(ColorStateList).

Parameters
tint ColorStateList?: the tint to apply, may be null to clear tint

setCheckMarkTintMode

Added in API level 21
open fun setCheckMarkTintMode(tintMode: PorterDuff.Mode?): Unit

Specifies the blending mode used to apply the tint specified by setCheckMarkTintList(android.content.res.ColorStateList) to the check mark drawable. The default mode is PorterDuff.Mode#SRC_IN.

Parameters
tintMode PorterDuff.Mode?: the blending mode used to apply the tint, may be null to clear tint

setChecked

Added in API level 1
open fun setChecked(checked: Boolean): Unit

Sets the checked state of this view.

Parameters
checked Boolean: true set the state to checked, false to uncheck

setVisibility

Added in API level 1
open fun setVisibility(visibility: Int): Unit
Parameters
visibility Int: One of VISIBLE, INVISIBLE, or GONE. Value is android.view.View#VISIBLE, android.view.View#INVISIBLE, or android.view.View#GONE

toggle

Added in API level 1
open fun toggle(): Unit

Protected methods

drawableStateChanged

Added in API level 1
protected open fun drawableStateChanged(): Unit

onCreateDrawableState

Added in API level 1
protected open fun onCreateDrawableState(extraSpace: Int): IntArray!
Parameters
extraSpace Int: if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.
Return
IntArray! Returns an array holding the current Drawable state of the view.

onDraw

Added in API level 1
protected open fun onDraw(canvas: Canvas): Unit
Parameters
canvas Canvas: the canvas on which the background will be drawn This value cannot be null.

verifyDrawable

Added in API level 1
protected open fun verifyDrawable(who: Drawable): 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. This allows animations for those drawables to be scheduled.

Be sure to call through to the super class when overriding this function.
If you override this method you must call through to the superclass implementation.

Parameters
who Drawable: This value cannot be null.
Return
Boolean boolean If true then the Drawable is being displayed in the view; else false and it is not allowed to animate.