How do I implement something like this:

enter image description here

I want to do that within a single TextView. Setting the background color of the TextView will not do the job.

I guess it should be possible with a spannable, but I don't know how.

In html I would do that:

<html>
<body>
        <span style="background:#CCCCCC;">first line <br /> second long line </span>
</body>
</html>

But i don't know how to do that on Android. The very last option would be to split the text into two text view, and set each textviews background color and with/height to wrap_content. But since the text length / count of words can be dynamically, I need to calculate the length of each word etc. There must be a better way :)

Edit
Report