Android APIs
public class

TextViewCompat

extends Object
java.lang.Object
   ↳ android.support.v4.widget.TextViewCompat

Class Overview

Helper for accessing features in TextView introduced after API level 4 in a backwards compatible fashion.

Summary

XML Attributes
Attribute Name Related Method Description
android:drawableBottom setCompoundDrawablesRelativeWithIntrinsicBounds(TextView,int,int,int,int) The drawable to be drawn below the text. 
android:drawableEnd setCompoundDrawablesRelativeWithIntrinsicBounds(TextView,int,int,int,int) The drawable to be drawn to the end of the text. 
android:drawableStart setCompoundDrawablesRelativeWithIntrinsicBounds(TextView,int,int,int,int) The drawable to be drawn to the start of the text. 
android:drawableTop setCompoundDrawablesRelativeWithIntrinsicBounds(TextView,int,int,int,int) The drawable to be drawn above the text. 
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

XML Attributes

android:drawableBottom

The drawable to be drawn below the text.

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

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

This corresponds to the global attribute resource symbol drawableBottom.

android:drawableEnd

The drawable to be drawn to the end of the text.

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

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

This corresponds to the global attribute resource symbol drawableEnd.

android:drawableStart

The drawable to be drawn to the start of the text.

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

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

This corresponds to the global attribute resource symbol drawableStart.

android:drawableTop

The drawable to be drawn above the text.

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

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

This corresponds to the global attribute resource symbol drawableTop.

Public Methods

public 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. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.

Calling this method will overwrite any Drawables previously set using setCompoundDrawables(Drawable, Drawable, Drawable, Drawable) or related methods.

Parameters
textView The TextView against which to invoke the method.

public 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. Use 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 setCompoundDrawables(Drawable, Drawable, Drawable, Drawable) or related methods.

Parameters
textView The TextView against which to invoke the method.

public 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. Use 0 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 setCompoundDrawables(Drawable, Drawable, Drawable, Drawable) or related methods.

Parameters
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.