Small & simple library to create a link url, mail, mention and tag in TextView. This is Xamarin.Android port of Bachors' Android-WordToSpan with little C#'s enhancement.
PM> Install-Package Karamunting.Android.Bachors.AndroidWordToSpan -Version 1.0.0
// Convert string to spannable & set text const string myText = "I know http://just.com/anu how to @whisper, And I #know just #how to cry,I know just @where to anu@find.com the answers"; var tv = FindViewById<TextView>(R.Id.txt); var wts = new WordToSpan(); // Set color link. Default = Color.Blue wts.SetColorTag(Color.Green); wts.SetColorUrl(Color.Magenta); wts.SetColorMail(Color.Pink); wts.SetColorMention(Color.Brown); // Click listener with event handler. // Call these before execute SetText() wts.Click += (s, e) => { #if DEBUG Log.Debug(nameof(MainActivity), "Triggered by Event Handler"); #endif Toast.MakeText(this, $"Type: {e.Type} | Text: {e.Text}", ToastLength.Short).Show(); }; wts.SetText(myText, tv); ``` You can also use Set ```csharp // Click listener. // Call these before execute SetText() wts.SetClickListener(new ClickListener((type, text) => { Toast.MakeText(this, $"Type: {type} | Text: {text}", ToastLength.Short).Show(); })); ``` MIT ---