Stay organized with collections
Save and categorize content based on your preferences.
TextLinkSpan
class TextLinkSpan : ClickableSpan
A ClickableSpan for a TextLink.
Applies only to TextViews.
Summary
Inherited functions |
From class CharacterStyle
CharacterStyle! |
getUnderlying()
Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by wrap , returns the underlying CharacterStyle.
|
CharacterStyle! |
wrap(cs: CharacterStyle!)
A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict.
|
|
|
Public constructors
Public methods
onClick
open fun onClick(widget: View): Unit
Parameters |
widget |
View: This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TextLinks.TextLinkSpan\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTextLinkSpan\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/textclassifier/TextLinks.TextLinkSpan \"View this page in Java\") \n\n```\nclass TextLinkSpan : ClickableSpan\n```\n\n|---|---|---|---------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||||\n| ↳ | [android.text.style.CharacterStyle](../../text/style/CharacterStyle.html#) |||\n| | ↳ | [android.text.style.ClickableSpan](../../text/style/ClickableSpan.html#) ||\n| | | ↳ | [android.view.textclassifier.TextLinks.TextLinkSpan](#) |\n\nA ClickableSpan for a TextLink.\n\nApplies only to TextViews.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [TextLinkSpan](#TextLinkSpan(android.view.textclassifier.TextLinks.TextLink))`(`textLink:` `[TextLinks.TextLink](/reference/kotlin/android/view/textclassifier/TextLinks.TextLink)`)` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|\n| [TextLinks.TextLink](/reference/kotlin/android/view/textclassifier/TextLinks.TextLink)! | [getTextLink](#getTextLink())`()` \u003cbr /\u003e |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onClick](#onClick(android.view.View))`(`widget:` `[View](../View.html#)`)` \u003cbr /\u003e |\n\n| Inherited functions ||\n|---|---|\n| From class [CharacterStyle](../../text/style/CharacterStyle.html#) |----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CharacterStyle](../../text/style/CharacterStyle.html#)! | [getUnderlying](../../text/style/CharacterStyle.html#getUnderlying())`()` Returns \"this\" for most CharacterStyles, but for CharacterStyles that were generated by [wrap](../../text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle)), returns the underlying CharacterStyle. \u003cbr /\u003e | | [CharacterStyle](../../text/style/CharacterStyle.html#)! | [wrap](../../text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle))`(`cs:` `[CharacterStyle](../../text/style/CharacterStyle.html#)!`)` A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict. \u003cbr /\u003e | ||\n| From class [ClickableSpan](../../text/style/ClickableSpan.html#) |----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](../../text/style/ClickableSpan.html#toString())`()` \u003cbr /\u003e | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateDrawState](../../text/style/ClickableSpan.html#updateDrawState(android.text.TextPaint))`(`ds:` `[TextPaint](../../text/TextPaint.html#)`)` Makes the text underlined and in the link color. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### TextLinkSpan\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTextLinkSpan(textLink: TextLinks.TextLink)\n```\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------|\n| `textLink` | [TextLinks.TextLink](/reference/kotlin/android/view/textclassifier/TextLinks.TextLink): This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### getTextLink\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getTextLink(): TextLinks.TextLink!\n``` \n\n### onClick\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onClick(widget: View): Unit\n```\n\n| Parameters ||\n|----------|-----------------------------------------------------|\n| `widget` | [View](../View.html#): This value cannot be `null`. |"]]