Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change link color when using LinkMovementMethod and Html.fromHtml

Tags:

android

I am using using Html.fromHtml to set the corresponding text for a TextView object. Said HTML has url links that I want users to be able to click on and open the browser to that link. I am using LinkMovementMethod to accomplish that fine and dandy. The problem is the link markup is coloring it in the traditional dark blue against a black background, this is bad. I'd like to keep the blackbackground color and change the link color to a lighter blue. How can I do this?

Here is a brief code snippet...

TextView servicesTextView = (TextView)activity.get().findViewById(R.id.ServicesText);
servicesTextView.setText(Html.fromHtml(servicesText));
servicesTextView.setMovementMethod(LinkMovementMethod.getInstance());
like image 229
Dennis Avatar asked Jul 06 '11 03:07

Dennis


1 Answers

Boy, each time I finally write a up a question on StackOverflow, I end up finding the answer myself.

TextView has setLinkTextColor method.

like image 161
Dennis Avatar answered Sep 17 '22 14:09

Dennis