Clickable link text for Android TextView — Kotlin Extension
Recently I have had to create UI that required user tappable/clickable text in the same text view. I know this is kind of unusual as the touch target for the view will likely be smaller compared to a button with no outline style. However, I wanted to share a quick Kotlin extension function that is dynamic and well tested.
Here is an example usage for generating clickable link within the same TextView
So, if your project requires something like this take a look at the following extension function for android.widget.TextView.
You should be able to easily convert this to Java if needed. Let me know if you find this useful. Cheers ✌️
Top comments (0)