Modifier and Type | Method and Description |
---|---|
static Drawable[] |
getCompoundDrawablesRelative(TextView textView)
Returns drawables for the start, top, end, and bottom borders from the given text view.
|
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 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,
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 |
setTextAppearance(TextView textView,
int resId)
Sets the text appearance from the specified style resource.
|
public static void setCompoundDrawablesRelative(@NonNull TextView textView, @Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom)
null
if you do not want a Drawable
there. The Drawables must already have had Drawable.setBounds(int, int, int, int)
called.
Calling this method will overwrite any Drawables previously set using
TextView.setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable)
or related methods.textView
- The TextView against which to invoke the method.public static void setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull TextView textView, @Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom)
null
if you do not want a Drawable
there. The Drawables' bounds will be set to their intrinsic bounds.
Calling this method will overwrite any Drawables previously set using
TextView.setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable)
or related methods.textView
- The TextView against which to invoke the method.public static void setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull TextView textView, @DrawableRes int start, @DrawableRes int top, @DrawableRes int end, @DrawableRes int bottom)
TextView.setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable)
or related methods.textView
- The TextView against which to invoke the method.start
- Resource identifier of the start Drawable.top
- Resource identifier of the top Drawable.end
- Resource identifier of the end Drawable.bottom
- Resource identifier of the bottom Drawable.public static int getMaxLines(@NonNull TextView textView)
public static int getMinLines(@NonNull TextView textView)
public static void setTextAppearance(@NonNull TextView textView, @StyleRes int resId)
Use a framework-defined TextAppearance
style like
@android:style/TextAppearance.Material.Body1
.
textView
- The TextView against which to invoke the method.resId
- The resource identifier of the style to apply.