In my app I use the Html.fromHtml(string).toString method to remove some <p> tags that are received when I parse some JSON.
If I leave the <p> tags on, the text fits the background perfectly (the background is a relative layout with wrap_content in both height and width.) However, if I use fromHtml to remove the <p> tags, suddenely there is a huge space below the text, which I believe is the fromHtml method adding in space at the end?
Any ideas?
EDIT:
Here are screenshots:
https://i.stack.imgur.com/S7PdD.jpg
The one with <p> tags is the one that doesnt use fromHtml, obviously! 🙂
EDIT 2: Solution has been found, see my answer below. Thank you to Andro Selva for helping me by telling me about the hidden /n that was being added!
Solution was found:
fromHtml returns the type Spanned. So I assigned what was being returned to a variable, converted it to a string and then used the .trim() method on it.
It removed all white space at the end.