在array.xml中添加超链接文本

时间:2014-06-19 11:31:36

标签: android xml

我使用array.xml创建列表并将其填充到listView中 问题是我需要在arrayItem decsription中添加一个超链接文本,所以当我将它填充到listView时它应该链接到我的网站!!!

    <string-array name="about_us">
    <item><b>What is it all about ?</b>\n\this is a mobile application </item>
    <item><b>Where all goods go ?</b>Currently the  goods can get delivered only in India.</item>
    <item><b>How will I Know more?</b>Click [HERE] to go to our website</item>
    </string-array>

有没有办法直接做到这一点?

1 个答案:

答案 0 :(得分:0)

Try this way,hope this will help you to solve your problem.

<string name="link">1.Click &lt;a href="http://www.google.com"> here &lt;/a> to goto wesite.</string>

textView.setMovementMethod (LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(getString(R.string.link)));