Compartir a través de


TextLinks.Apply(ISpannable, ApplyStrategy, IFunction) Method

Definition

Annotates the given text with the generated links.

[Android.Runtime.Register("apply", "(Landroid/text/Spannable;ILjava/util/function/Function;)I", "", ApiSince=28)]
public Android.Views.TextClassifiers.ApplyStatusCode Apply (Android.Text.ISpannable text, Android.Views.TextClassifiers.ApplyStrategy applyStrategy, Java.Util.Functions.IFunction? spanFactory);
[<Android.Runtime.Register("apply", "(Landroid/text/Spannable;ILjava/util/function/Function;)I", "", ApiSince=28)>]
member this.Apply : Android.Text.ISpannable * Android.Views.TextClassifiers.ApplyStrategy * Java.Util.Functions.IFunction -> Android.Views.TextClassifiers.ApplyStatusCode

Parameters

text
ISpannable

the text to apply the links to. Must match the original text

applyStrategy
ApplyStrategy

the apply strategy used to determine how to apply links to text. e.g TextLinks#APPLY_STRATEGY_IGNORE

spanFactory
IFunction

a custom span factory for converting TextLinks to TextLinkSpans. Set to null to use the default span factory.

Returns

a status code indicating whether or not the links were successfully applied e.g. #STATUS_LINKS_APPLIED

Attributes

Remarks

Annotates the given text with the generated links. It will fail if the provided text doesn't match the original text used to create the TextLinks.

<strong>NOTE: </strong>It may be necessary to set a LinkMovementMethod on the TextView widget to properly handle links. See TextView#setMovementMethod(MovementMethod)

Java documentation for android.view.textclassifier.TextLinks.apply(android.text.Spannable, int, java.util.function.Function<android.view.textclassifier.TextLinks.TextLink, android.view.textclassifier.TextLinks.TextLinkSpan>).

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