Quantcast
Viewing all articles
Browse latest Browse all 8068

Attributed string - override link color?

I'm using attributedString to highlight snippets of text and also use those to link somewhere with ATTRIBUTE_LINK. However, the problem I'm having is that setting the ATTRIBUTE_LINK attribute results in blue underlined text and I cannot seem to change it. I can't remove the underline or set a new foreground colour - or anything really!

For reference, this is basically what I have:

var atxt = Ti.UI.iOS.createAttributedString({
  text: 'Some text to highlight etc'
});
 
atxt.addAttribute({
  type: Titanium.UI.iOS.ATTRIBUTE_LINK,
  value: 'http://www.google.com',
  range: [0, 10]
});
 
atxt.addAttribute({
  type: Ti.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,
  value: 'red',
  range: [0, 10]
});
 
var label1 = Ti.UI.createLabel({
  attributedString: atxt,
});
Changing the order of attributes doesn't have an effect either.

Is there any way to format a link in attributed strings? Am I doing something wrong?


Viewing all articles
Browse latest Browse all 8068

Trending Articles