【发布时间】:2012-12-22 04:47:26
【问题描述】:
我想在 textview 上显示超链接,但不在 url 上,例如:嗨,“url”如何。(这里的 url 将打开 www.google.com)。所有这些都将在警报对话框中..
我遵循了以下方法,但没有得到正确的解决方案..
String.xml---
谷歌
String str = getResources().getString(R.string.link);
final TextView txtvw = new TextView(this);
txtvw.setText(Html.fromHtml(str));
txtvw.setClickable(true);
txtvw.setAutoLinkMask(RESULT_OK);
txtvw.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(txtvw, Linkify.WEB_URLS);
AlertDialog.Builder alt_bld = new AlertDialog.Builder(context);
alt_bld.setTitle(title);
alt_bld.setCancelable(false);
alt_bld.create();
alt_bld.setView(txtvw).show();
【问题讨论】:
标签: android hyperlink android-alertdialog