TextViewCompat

Helper for accessing features in TextView.

Types

Link copied to clipboard

Properties

Link copied to clipboard
The TextView does not auto-size text (default).
Link copied to clipboard
The TextView scales text size both horizontally and vertically to fit within the container.

Functions

Link copied to clipboard
open fun getAutoSizeMaxTextSize(@NonNull textView: @NonNull TextView): Int
Link copied to clipboard
open fun getAutoSizeMinTextSize(@NonNull textView: @NonNull TextView): Int
Link copied to clipboard
open fun getAutoSizeStepGranularity(@NonNull textView: @NonNull TextView): Int
Link copied to clipboard
open fun getAutoSizeTextAvailableSizes(@NonNull textView: @NonNull TextView): @NonNull Array<Int>
Link copied to clipboard
open fun getAutoSizeTextType(@NonNull textView: @NonNull TextView): Int
Returns the type of auto-size set for this widget.
Link copied to clipboard
open fun getCompoundDrawablesRelative(@NonNull textView: @NonNull TextView): @NonNull Array<Drawable>
Returns drawables for the start, top, end, and bottom borders from the given text view.
Link copied to clipboard
@Nullable
open fun getCompoundDrawableTintList(@NonNull textView: @NonNull TextView): @Nullable ColorStateList
Return the tint applied to any compound drawables.
Link copied to clipboard
open fun getCompoundDrawableTintMode(@NonNull textView: @NonNull TextView): @Nullable PorterDuff.Mode
Return the tint mode applied to any compound drawables.
Link copied to clipboard
open fun getFirstBaselineToTopHeight(@NonNull textView: @NonNull TextView): Int
Returns the distance between the first text baseline and the top of this TextView.
Link copied to clipboard
open fun getLastBaselineToBottomHeight(@NonNull textView: @NonNull TextView): Int
Returns the distance between the last text baseline and the bottom of this TextView.
Link copied to clipboard
open fun getMaxLines(@NonNull textView: @NonNull TextView): Int
Returns the maximum number of lines displayed in the given TextView, or -1 if the maximum height was set in pixels instead.
Link copied to clipboard
open fun getMinLines(@NonNull textView: @NonNull TextView): Int
Returns the minimum number of lines displayed in the given TextView, or -1 if the minimum height was set in pixels instead.
Link copied to clipboard
open fun getTextMetricsParams(@NonNull textView: @NonNull TextView): @NonNull PrecomputedTextCompat.Params
Gets the parameters for text layout precomputation, for use with PrecomputedTextCompat.
open fun setAutoSizeTextTypeUniformWithConfiguration(@NonNull textView: @NonNull TextView, autoSizeMinTextSize: Int, autoSizeMaxTextSize: Int, autoSizeStepGranularity: Int, unit: Int)
Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.
open fun setAutoSizeTextTypeUniformWithPresetSizes(@NonNull textView: @NonNull TextView, presetSizes: @NonNull Array<Int>, unit: Int)
Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.
Link copied to clipboard
open fun setAutoSizeTextTypeWithDefaults(@NonNull textView: @NonNull TextView, autoSizeTextType: Int)
Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds by using the default auto-size configuration.
Link copied to clipboard
open fun setCompoundDrawablesRelative(@NonNull textView: @NonNull TextView, @Nullable start: @Nullable Drawable, @Nullable top: @Nullable Drawable, @Nullable end: @Nullable Drawable, @Nullable bottom: @Nullable Drawable)
Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.
open fun setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull textView: @NonNull TextView, @Nullable start: @Nullable Drawable, @Nullable top: @Nullable Drawable, @Nullable end: @Nullable Drawable, @Nullable bottom: @Nullable Drawable)
open fun setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull textView: @NonNull TextView, @DrawableRes start: Int, @DrawableRes top: Int, @DrawableRes end: Int, @DrawableRes bottom: Int)
Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.
Link copied to clipboard
open fun setCompoundDrawableTintList(@NonNull textView: @NonNull TextView, @Nullable tint: @Nullable ColorStateList)
Applies a tint to any compound drawables.
Link copied to clipboard
open fun setCompoundDrawableTintMode(@NonNull textView: @NonNull TextView, tintMode: @Nullable PorterDuff.Mode)
Applies a tint mode to any compound drawables.
Link copied to clipboard
open fun setCustomSelectionActionModeCallback(@NonNull textView: @NonNull TextView, callback: @NonNull ActionMode.Callback)
Sets a selection action mode callback on a TextView.
Link copied to clipboard
open fun setFirstBaselineToTopHeight(@NonNull textView: @NonNull TextView, @Px @IntRange(from = 0) firstBaselineToTopHeight: Int)
Updates the top padding of the TextView so that firstBaselineToTopHeight is equal to the distance between the first text baseline and the top of this TextView.
Link copied to clipboard
open fun setLastBaselineToBottomHeight(@NonNull textView: @NonNull TextView, @Px @IntRange(from = 0) lastBaselineToBottomHeight: Int)
Updates the bottom padding of the TextView so that lastBaselineToBottomHeight is equal to the distance between the last text baseline and the bottom of this TextView.
Link copied to clipboard
open fun setLineHeight(@NonNull textView: @NonNull TextView, @Px @IntRange(from = 0) lineHeight: Int)
Sets an explicit line height for this TextView.
open fun setLineHeight(@NonNull textView: @NonNull TextView, unit: Int, @FloatRange(from = 0) lineHeight: Float)
Sets an explicit line height to a given unit and value for the TextView.
Link copied to clipboard
open fun setPrecomputedText(@NonNull textView: @NonNull TextView, @NonNull precomputed: @NonNull PrecomputedTextCompat)
Sets the PrecomputedTextCompat to the TextView If the given PrecomputeTextCompat is not compatible with textView, throws an IllegalArgumentException.
Link copied to clipboard
open fun setTextAppearance(@NonNull textView: @NonNull TextView, @StyleRes resId: Int)
Sets the text appearance from the specified style resource.
Link copied to clipboard
open fun setTextMetricsParams(@NonNull textView: @NonNull TextView, params: @NonNull PrecomputedTextCompat.Params)
Apply the text layout parameter.
Link copied to clipboard
open fun wrapCustomSelectionActionModeCallback(@NonNull textView: @NonNull TextView, callback: @Nullable ActionMode.Callback): @Nullable ActionMode.Callback