【发布时间】:2019-09-26 23:29:12
【问题描述】:
下面是我的字符串
String txtLink = "<p>Apply directly in our <a
href=\"https://theorem.applytojob.com/apply/TyJy6YCsOs/Experienced-
Backend-Engineer-Ruby?source=GitHub+Jobs\">careers page</a></p>";
我需要在 Android 中可以点击锚标记。到目前为止我尝试过的是
txtJobLink.setText(""+Html.fromHtml(txtLink));
txtJobLink.setMovementMethod(BetterLinkMovementMethod.newInstance());
BetterLinkMovementMethod.linkify(Linkify.ALL,txtJobLink);
BetterLinkMovementMethod.linkifyHtml(txtJobLink);
txtJobLink.setLinksClickable(true);
【问题讨论】:
-
尝试将链接放在一个撇号内。
-
它来自 API