添加在array.xml超链接文本 [英] Adding a Hyperlinked text in the array.xml

查看:173
本文介绍了添加在array.xml超链接文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的array.xml创建列表,并将其填充到ListView控件
问题是我需要在arrayItem decsription中添加一个超链接的文本,比我填充它变成ListView控件应该链接到我的网站!

 <字符串数组名=about_us>
    <项目>< B>什么是一回事< / B> \\ n \\这是一个移动应用程序和LT; /项目>
    <项目>< B>其中所有商品去< / B>目前该产品只能在印度被传递< /项目>
    <项目>< B>我怎么会知道详情< / B>点击[这里]到我们的网站< /项目>
    < /字符串数组>

有没有办法做它直?


解决方案

 试试这个办法,希望这将帮助你解决你的问题。<字符串名称=链接> 1.Click&放大器; LT; A HREF =htt​​p://www.google.com>这里和放大器; LT; / A>要转到wesite< /串>textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(的getString(R.string.link)));

I was creating list using the array.xml and populating it into listView The problem is I need to add a hyperLinked text within the arrayItem decsription so than when I populate it into listView it should link to my website!!!

    <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>

is there any way for doing it straight?

解决方案

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)));

这篇关于添加在array.xml超链接文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆