开发者

Change link color when using LinkMovementMethod and Html.fromHtml

开发者 https://www.devze.com 2023-03-18 10:49 出处:网络
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 LinkMov

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 th开发者_StackOverflow社区e 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消