简体   繁体   English

Android html.fromhtml()网址意图

[英]Android html.fromhtml() url intents

Is it possible that the hyperlinks in the parsed html from Html.fromHtml() start a intent. 从Html.fromHtml()解析的html中的超链接是否有可能启动意图。 I put this parsed html from Html.fromhtml() in a textview. 我将来自Html.fromhtml()的经过解析的html放在了textview中。

I can't find anything on google or the Android developers website. 我在Google或Android开发者网站上找不到任何内容。

I'm not sure what you're asking, but if I squint right, you might be talking about behavior due to auto-linkifying : 我不确定您要问的是什么,但是如果我斜视正确,则可能是由于自动链接导致的行为:

Controls whether links such as urls and email addresses are automatically found and converted to clickable links. 控制是否自动找到诸如URL和电子邮件地址之类的链接并将其转换为可点击的链接。 The default value is "none", disabling this feature. 默认值为“ none”,禁用此功能。

you can use this: 您可以使用此:

import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;



  SpannableString str = new SpannableString("your string");
  Linkify.addLinks(str, Linkify.WEB_URLS);

  textview.setText(str);
  textview.setMovementMethod(LinkMovementMethod.getInstance());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM