Android系统是否有可能增加一个可点击的链接成一个字符串资源 [英] Android-Is it possible to add a clickable link into a string resource

查看:142
本文介绍了Android系统是否有可能增加一个可点击的链接成一个字符串资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常设立某种形式的 AlertDialog 来火了,当用户第一次使用我的应用程序之一,我将解释如何使用应用程序,并给出一个总体介绍他们刚刚下载。我也通常是从的strings.xml 文件加载我的琴弦。

I usually set up some kind of AlertDialog to fire off when a user first uses one of my apps and I explain how to use the app and give an overall introduction to what they just downloaded. I also usually load my strings from a strings.xml file.

我想要做的就是让一家之言在我的字符串资源可点击喜欢的网页上的超链接。基本上,你就会有一个 AlertDialog ,并在字符串资源将有一个高亮度的单词或者可能只是一个网址,他们可以preSS。我想我可以只添加一个按钮,就带他们到现场,但我只是想知道,如果让一个词在你的字符串资源可点击的超链接是可能的。

What I want to do is make one of the words in my string resource clickable like a hyperlink on a web page. Basically you'd have an AlertDialog and within the string resource there would be a highlighted word or possibly just a web address that they could press. I suppose I could just add a button that would take them to the site but I just wanted to know if making a word in your string resource a clickable hyperlink was possible.

推荐答案

只需使用HTML格式的链接在您的资源:

Just use an HTML format link in your resource:

<字符串名称=my_link>< A HREF =htt​​p://somesite.com/>!点击我< / A>< /串>

您可以再使用 setMovementMethod(LinkMovementMethod.getInstance())的TextView ,使链接点击。

You can then use setMovementMethod(LinkMovementMethod.getInstance()) on your TextView to make the link clickable.

还有的TextView 机器人:自动链接属性,也应努力

这篇关于Android系统是否有可能增加一个可点击的链接成一个字符串资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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