简体   繁体   中英

Change link color when using LinkMovementMethod and Html.fromHtml

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());

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

TextView has setLinkTextColor method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM