TextView.TextFormatted Property

Definition

Return the text that TextView is displaying. -or- Sets the text to be displayed.

public Java.Lang.ICharSequence? TextFormatted { [Android.Runtime.Register("getText", "()Ljava/lang/CharSequence;", "GetGetTextHandler")] get; [Android.Runtime.Register("setText", "(Ljava/lang/CharSequence;)V", "")] set; }
[<get: Android.Runtime.Register("getText", "()Ljava/lang/CharSequence;", "GetGetTextHandler")>]
[<set: Android.Runtime.Register("setText", "(Ljava/lang/CharSequence;)V", "")>]
member this.TextFormatted : Java.Lang.ICharSequence with get, set

Property Value

The text displayed by the text view.

Attributes

Remarks

Property getter documentation:

Return the text that TextView is displaying. If #setText(CharSequence) was called with an argument of android.widget.TextView.BufferType#SPANNABLE BufferType.SPANNABLE or android.widget.TextView.BufferType#EDITABLE BufferType.EDITABLE, you can cast the return value from this method to Spannable or Editable, respectively.

The content of the return value should not be modified. If you want a modifiable one, you should make your own copy first.

Java documentation for android.widget.TextView.getText().

Property setter documentation:

Sets the text to be displayed. TextView <em>does not</em> accept HTML-like formatting, which you can do with text strings in XML resource files. To style your strings, attach android.text.style.* objects to a android.text.SpannableString, or see the Available Resource Types documentation for an example of setting formatted text in the XML resource file. <p/> When required, TextView will use android.text.Spannable.Factory to create final or intermediate Spannable Spannables. Likewise it will use android.text.Editable.Factory to create final or intermediate Editable Editables.

If the passed text is a PrecomputedText but the parameters used to create the PrecomputedText mismatches with this TextView, IllegalArgumentException is thrown. To ensure the parameters match, you can call TextView#setTextMetricsParams before calling this.

Java documentation for android.widget.TextView.setText(java.lang.CharSequence).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to