I'd like to know if anyone could help me with this.
I've got a textView and I want the background just to be applied to the text, according to its size, not to the whole textView.
There is no problem when the text is only one row lenghth, but there is when it takes more than one line...
Maybe this pic helps to understand this all...
top: what I have bottom: what I want
Thank you :-)
Try using something like this:
TextView tv = (TextView) findViewById(R.id.myid);
tv.setText(Html.fromHtml("<span style="background: red;">Text</span>"));
It might resolve your issue...
EDIT:
I found the solution here : Set color of TextView span in Android using SpannableString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With