Unwanted newline in TextView using HTML

I have a TextView that displays a string with some HTML to change the format. I am using this code:

text = "What symbol do 'all, only, <b>l</b>ike' have in common?";
title.setText(Html.fromHtml(text));

The problem is that a new line character is inserted when it is not needed, that is, I get this:

What symbol do 'all, only, 
like' 
have in common?

The gap after "only" is right (there is no more space on this line), but the break after "like" is not needed.

I did tests, and if in the line I change the bold tag from "l" to "like" to "l" to "only", that is, I have this:

text = "What symbol do 'all, on<b>l</b>y, like' have in common?";

the text is correctly broken:

What symbol do 'all, only, 
like' have in common?

This puzzles me because it is exactly the same string, except for this, and this should not affect the length of the string.

Am I doing something wrong? This is mistake?

Update: My TextView in XML is as follows:

<TextView 
    android:textAppearance="?android:textAppearanceLarge"
    android:textColor="#ff000000" 
    android:id="@+id/title"
    android:paddingLeft="10.0sp" 
    android:paddingRight="10.0sp"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:text="Waiting for initialization..." />
+5
1

android: layout_width = "wrap_content" - . , , android: layout_width = "match_parent".

0

All Articles