skip to Main Content

I am trying to achieve something as in the picture. I have a lot of HTML files in my app for which I want to achieve individual highlighting, adding annotations etc.

I’m unable to achieve the desired result though. My plan is to add each individual sentence to a database and then have some additional fields along each row for formatting etc. I can’t understand how to chain up the textviews though. I’ve tried out a few experiments of my own for a few hours now.

Can anyone help me with this, please?

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Many thanks, Piotr, for pointing me in the correct direction. After a lot of faffing around, I've finally managed to achieve everything using SpannableString and ClickableSpan. Anyone wanting further explanation on this topic, please get in touch with me and I'd be more than happy to help. I do not wish to post my code here as it consists of a lot of my personal software code as well. But if required, I'm happy to strip it down and post it.


  2. I don’t see a reason to use ConstraintLayout here.
    One TextView should be enough.

    To set different text styles on particular words or sentences, use Spans: https://medium.com/androiddevelopers/spantastic-text-styling-with-spans-17b0c16b4568

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search