Greetings.

I am writing an android application, my text data is stored in the database, it is processed there by HTML tags, having received this data in my application, I load it into a textview as follows:

  question_text.setText(Html.fromHtml(QUESTION_TEXT)); 

Everything works, however, I have a need to insert a footnote inside the text, in HTML it is put like this:

  <sup><acronym title="Текст сноски">[1]</acronym></sup> 

I registered this code in the text in the database, and the footnote was displayed, but when you hover or click on it, nothing happens. Question: How to correctly write the footnote code in the database so that the android application correctly displays this footnote? Is it possible at all?

  • Means out of the box, this is, I think, impossible. - post_zeew

1 answer 1

This method provides very limited HTML support.
For full-fledged, you need to use WebView, this is an engine from the built-in browser, you can enable JavaScript there, and use JS and CSS to implement any functionality, just remember to test well on the minimum and maximum supported OS versions, especially if this range passes through 4.4, where WebKit engine was replaced by Chromium.

  • It turns out that I can create a separate directory, put there, for example, html, css, js files interconnected, and point to the main index file, and the web view will simply display this all? Or an alternative way is to specify a simple Url link? - McDaggen
  • @McDaggen It is possible without any files at all, just HTML from a string, in it you can inline CSS and inline JS. - Rou1997
  • Clarity is complete! - McDaggen