发生在一个复选框的文本超链接? [英] Place a hyperlink in the text of a checkbox?
问题描述
我有了这个文本的复选框:我同意的条款和条件。我需要的条款与条件是蓝色,下划线,触摸时打开网页。
I have a checkbox that has this text: "I agree to the terms and conditions". I need "terms and conditions" to be blue, underlined, and open a webpage when touched.
我没有找到Linkify类(http://developer.android.com/reference/android/text/util/Linkify.html),但这似乎已经将URL中的文本来链接。
I did find the Linkify class (http://developer.android.com/reference/android/text/util/Linkify.html), but this seems to turn URLs already in text into to links.
我怎样才能做到这一点?
How can I do this?
推荐答案
彩色文本的蓝色,并添加一个onClick监听它,启动意图查看URL。您可以通过 Html.fromHtml标记使用HTML语法类似文本()
。见<一href=\"http://stackoverflow.com/questions/1529068/android-is-it-possible-to-have-multiple-styles-inside-a-textview/1533512#1533512\">this回答获取更好的解释和例子。
Color the text blue and add an onClick Listener to it that launches the intent to view the URL. You can markup your text using HTML like syntax via Html.fromHtml()
. See this answer for better explanation and example.
这篇关于发生在一个复选框的文本超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!