Skip to main content

TextView

declare class TextView extends View {}

A user interface element that displays text to the user.

Attribute

text

<TextView text="hello" />
  • Description

    Text to display.

hint

<TextView hint="hello" />
  • Description

    Hint text to display when the text is empty.

textSize

<TextView textSize="20px" />
  • Description

    Size of the text.

fontFamily

<TextView fontFamily="Arial" />
  • Description

    Font family (named by string or as a font resource reference) for the text.

textStyle

<TextView textStyle="normal" />
  • Description

    Style (normal, bold, italic, bold|italic) for the text.

textColor

<TextView textColor="#ffffff" />
  • Description

    Text color #ffffff rgb(0,0,0) rgba(0,0,0,0.5)

textColorHint

<TextView textColorHint="#ffffff" />
  • Description

    Color of the hint text.

Instance Method

setText

declare class TextView {
setText(text: CharSequence):void;
}
  • Description

    Sets the text to be displayed using a string resource identifier.

getText

declare class TextView {
getText(): CharSequence;
}
  • Description

    Return the text that TextView is displaying.

setHint

declare class TextView {
setHint(hint:CharSequence): void;
}
  • Description

    Sets the text to be displayed when the text of the TextView is empty.

getHint

declare class TextView {
getHint(): CharSequence;
}
  • Description

    Returns the hint that is displayed when the text of the TextView is empty.

setTextSize

declare class TextView {
setTextSize(size: number): void;
}
  • Description

    Set the default text size to the given value, interpreted as "scaled pixel" units.

setTextColor

declare class TextView {
setTextColor(color: number): void;
}
  • Description

    Sets the text color for all the states (normal, selected, focused) to be this color.