TextViewCompat

public final class TextViewCompat
extends Object

java.lang.Object
   ↳ androidx.core.widget.TextViewCompat


Helper for accessing features in TextView.

Summary

Constants

int AUTO_SIZE_TEXT_TYPE_NONE

The TextView does not auto-size text (default).

int AUTO_SIZE_TEXT_TYPE_UNIFORM

The TextView scales text size both horizontally and vertically to fit within the container.

Public methods

static int getAutoSizeMaxTextSize(TextView textView)
static int getAutoSizeMinTextSize(TextView textView)
static int getAutoSizeStepGranularity(TextView textView)
static int[] getAutoSizeTextAvailableSizes(TextView textView)
static int getAutoSizeTextType(TextView textView)

Returns the type of auto-size set for this widget.

static ColorStateList getCompoundDrawableTintList(TextView textView)

Return the tint applied to any compound drawables.

static PorterDuff.Mode getCompoundDrawableTintMode(TextView textView)

Return the tint mode applied to any compound drawables.

static Drawable[] getCompoundDrawablesRelative(TextView textView)

Returns drawables for the start, top, end, and bottom borders from the given text view.

static int getFirstBaselineToTopHeight(TextView textView)

Returns the distance between the first text baseline and the top of this TextView.

static int getLastBaselineToBottomHeight(TextView textView)

Returns the distance between the last text baseline and the bottom of this TextView.

static int getMaxLines(TextView textView)

Returns the maximum number of lines displayed in the given TextView, or -1 if the maximum height was set in pixels instead.

static int getMinLines(TextView textView)

Returns the minimum number of lines displayed in the given TextView, or -1 if the minimum height was set in pixels instead.

static PrecomputedTextCompat.Params getTextMetricsParams(TextView textView)

Gets the parameters for text layout precomputation, for use with PrecomputedTextCompat.

static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int autoSizeMinTextSize, int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit)

Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.

static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] presetSizes, int unit)

Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.

static void setAutoSizeTextTypeWithDefaults(TextView textView, int autoSizeTextType)

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.

static void setCompoundDrawableTintList(TextView textView, ColorStateList tint)

Applies a tint to any compound drawables.

static void setCompoundDrawableTintMode(TextView textView, PorterDuff.Mode tintMode)

Applies a tint mode to any compound drawables.

static void setCompoundDrawablesRelative(TextView textView, Drawable start, Drawable top, Drawable end, Drawable bottom)

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, int start, int top, int end, int bottom)

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable start, Drawable top, Drawable end, Drawable bottom)

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

static void setCustomSelectionActionModeCallback(TextView textView, ActionMode.Callback callback)

Sets a selection action mode callback on a TextView.

static void setFirstBaselineToTopHeight(TextView textView, int firstBaselineToTopHeight)

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.

static void setLastBaselineToBottomHeight(TextView textView, int lastBaselineToBottomHeight)

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.

static void setLineHeight(TextView textView, int lineHeight)

Sets an explicit line height for this TextView.

static void