Xamarin:更改 UITextView 中自动检测到的 link 颜色并保留下划线

Xamarin: Change auto detected link color in UITextView and keep the underline

在 Xamarin.iOS 中,如何更改 UITextView 中自动检测到的 link 的文本颜色并仍然保留下划线?

目前,我有:

_textView = new UITextView
{
     Editable = false,
     DataDetectorTypes = UIDataDetectorType.Link,
     ScrollEnabled = false
};

如果我在 UITextView 上设置 TintColor,那么 link 颜色会改变,但下划线会从 link 中移除。我也想保留下划线。

可以设置TextView的Attribute样式

var linkColr= UIStringAttributeKey.ForegroundColor;
var value1 = UIColor.Red;

var linkStyle= UIStringAttributeKey.UnderlineStyle;
var value2 = new NSNumber(1);

var dic = new NSDictionary(linkColr, value1, linkStyle, value2);
_textView .WeakLinkTextAttributes = dic;