Android系统是否有可能增加一个可点击的链接成一个字符串资源有可能、字符串、链接、系统

2023-09-05 03:45:52 作者:可口不可乐

我通常设立某种形式的 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 机器人:自动链接属性,也应努力