AppCompatTextView
open class AppCompatTextView : TextView, TintableBackgroundView, TintableCompoundDrawablesView, AutoSizeableTextView
kotlin.Any | |||
↳ | android.view.View | ||
↳ | android.widget.TextView | ||
↳ | androidx.appcompat.widget.AppCompatTextView |
A TextView
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
. - Supports auto-sizing via
androidx.core.widget.TextViewCompat
by allowing to instruct aTextView
to let the size of the text expand or contract automatically to fill its layout based on the TextView's characteristics and boundaries. The style attributes associated with auto-sizing areandroidx.appcompat.R.attr#autoSizeTextType
,androidx.appcompat.R.attr#autoSizeMinTextSize
,androidx.appcompat.R.attr#autoSizeMaxTextSize
,androidx.appcompat.R.attr#autoSizeStepGranularity
andandroidx.appcompat.R.attr#autoSizePresetSizes
, all of which work back toIce Cream Sandwich
.
This will automatically be used when you use TextView
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 Int | |
open Int | |
open CharSequence! |
getText() |
open TextClassifier |
Returns the |
open PrecomputedTextCompat.Params |
Gets the parameters for text layout precomputation, for use with |
open InputConnection! |
onCreateInputConnection(outAttrs: EditorInfo!) |
open Unit |
setBackgroundDrawable(@Nullable background: Drawable?) |
open Unit |
setBackgroundResource(@DrawableRes resId: Int) |
open Unit |
setCompoundDrawables(@Nullable left: Drawable?, @Nullable top: Drawable?, @Nullable right: Drawable?, @Nullable bottom: Drawable?) |
open Unit |
setCompoundDrawablesRelative(@Nullable start: Drawable?, @Nullable top: Drawable?, @Nullable end: Drawable?, @Nullable bottom: Drawable?) |
open Unit |
setCompoundDrawablesRelativeWithIntrinsicBounds(@Nullable start: Drawable?, @Nullable top: Drawable?, @Nullable end: Drawable?, @Nullable bottom: Drawable?) |
open Unit |