我試圖在about框中添加指向Twitter個人資料的鏈接。 「常規」的鏈接,如電子郵件地址和網址由無法讓HREF在Android strings.xml中工作
android:autoLink="email|web"
在about.xml處理,但對於Twitter的個人資料頁,我需要在我的strings.xml使用HTML代碼。我已經試過:
<string name="twitter">Follow us on <a href=\"http://www.twitter.com/mytwitterprofile">Twitter: @mytwitterprofile</a></string>
這使得在關於對話框HTML標記。
我也試過:
<string name="twitter">Follow us on <a href="http://www.twitter.com/mytwitterprofile">Twitter: @mytwitterprofile</a></string>
其中顯示文本「在Twitter上關注我們:@mytwitterprofile」,但它不是一個超鏈接。
我該如何做這個看似簡單的任務!?
乾杯, 巴里
你如何將字符串添加到您的框? – rajath 2011-04-22 12:52:01
TextView textView =(TextView)findViewById(R.id.about_content); \t \t textView.setTextColor(Color.WHITE); (getString(R.string.about_text,getString(R.string.twitter),getString(R.string.email_address),getString(R.string.website)));}}; – barry 2011-04-22 16:01:48
看看你是否覺得這篇文章有用 - http://stackoverflow.com/questions/1997328/android-clickable-hyperlinks-in-alertdialog – rajath 2011-04-22 12:56:54