TextView.TextFormatted 屬性

定義

傳回 TextView 正在顯示的文字。 -或- 設定要顯示的文字。

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

屬性值

文字檢視所顯示的文字。

屬性

備註

屬性 getter 檔:

傳回 TextView 正在顯示的文字。 如果使用 #setText(CharSequence)android.widget.TextView.BufferType#EDITABLE BufferType.EDITABLEandroid.widget.TextView.BufferType#SPANNABLE BufferType.SPANNABLE自變數呼叫 ,您可以分別將這個方法的傳回值轉換為 Spannable 或 Editable。

不應該修改傳回值的內容。 如果您想要可修改的複本,您應該先製作自己的複本。

android.widget.TextView.getText()Java 檔。

屬性 setter 檔:

設定要顯示的文字。 TextView <em>不接受<>類似 HTML 的格式,您可以在 XML 資源檔中使用文字字串。 若要設定字串樣式,請將Android.text.style.* 物件附加至 android.text.SpannableString,或參閱 可用的資源類型 檔,以取得在 XML 資源文件中設定格式化文字的範例。 <p/> 必要時,TextView 會用來 android.text.Spannable.Factory 建立最終或中繼 Spannable Spannables。 同樣地,它會使用 android.text.Editable.Factory 來建立最終或中繼 Editable Editables

如果傳遞的文字是 , PrecomputedText 但用來建立 PrecomputedText 的參數與這個 TextView 不符,則會擲回 IllegalArgumentException。 若要確保參數相符,您可以在呼叫這個之前呼叫 TextView#setTextMetricsParams

android.widget.TextView.setText(java.lang.CharSequence)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於