2011-04-22 61 views
6

我想將text設置爲包含href標籤以及普通http鏈接的textview。例如,這樣的文字"please <a href=/'http://google.com' target='_blank'>click here</a>. or visit http://yahoo.com ".Android TextView啓用LinkiFy和Href標籤

問題是我無法將兩個屬性設置在一起。如果我將Html.fromHtml設置爲文本,則帶有href標記的鏈接將突出顯示。但Linkfy屬性不適用於「http://yahoo.com」,反之亦然。是否有任何默認屬性來啓用TextView中的href標籤和普通鏈接。

感謝,

+0

您是否找到了解決方案? – R4j 2015-06-30 15:35:22

回答

-3

如果使用MX控件標籤(火花不支持此再)u可以使用的htmlText像下面的示例是可能的:

import mx.controls.Label //class need to be imported 

var textview:Label = new Label(); 
textview.htmlText = "please <a href=/'http://google.com' target='_blank'>click here</a>. or visit http://yahoo.com"; 
yourItemContainer.addElement(textview); 

這應該工作。但我不知道是否有可能使用普通標籤。

+0

謝謝你的回覆。但我無法在Android中找到上面的類標籤。我可以知道它是否與腳本語言有關? – Senthil 2011-04-22 07:17:17

+0

好吧,我剛纔發現我不再是flex標籤了:p。我使用flex併爲Android和iOS製作移動應用程序。在flex中,我可以在我的視圖中使用標籤。 – 2011-04-22 07:19:37