I have a text in HTML with links external and internal (page navigation). When I use this text in Html.fromHtml and display it in a TextView, external links work, but inside the page itself, it does not go. I have already tried both setMovementMethod and Linkify - everything is not right. I know that it works through WebView, but it will be much faster and more convenient to work this way.
Code sample:
private void showText(String text) {
TextView content = view.findViewById(R.id.textContent);
content.setText(Html.fromHtml(text, FROM_HTML_MODE_COMPACT));
content.setMovementMethod(LinkMovementMethod.getInstance());
}
Text sample:
The text is long, contained in a ScrollView, has <a name="sdfootnoteAanc" href="#sdfootnoteAsym"> links </a> within itself, such as footnotes. When pressed, the text should scroll to <a name="sdfootnoteAsym" href="#sdfootnoteAanc"> link location </a>, and then back - as often happens on sites.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…