2

I have some problem with ellipsize in TextView.

Here is html string:

final String str = "His followed carriage proposal entrance <br/>directly had elegance. Greater for cottage gay parties natural. Remaining he furniture on he discourse suspected perpetual. <br/>Power dried her taken place day ought the. Four and our ham west miss."

I create 2 textview(tv_test_html, tv_test_normal).

<TextView
            android:id="@+id/tv_test_html"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:maxLines="3"
            android:ellipsize="end"
            android:text="Hello"
            />
<TextView
            android:layout_marginTop="20dp"
            android:id="@+id/tv_test_normal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:maxLines="3"
            android:ellipsize="end"
            android:text="Hello"
            />

In code I set:

 final TextView tvTestHtml = (TextView) findViewById(R.id.tv_test_html);
 final TextView tvTestNormal = (TextView) findViewById(R.id.tv_test_normal);
 tvTestHtml.setText(Html.fromHtml(str));
 tvTestNormal.setText(str);

When I run application:

result

You can see "..." is error when I use Html.fromHtml(...);

So how do I fix it ?

Thanks in advance !

[I just update image]

Community
  • 1
  • 1
quangson91
  • 1,044
  • 1
  • 16
  • 30

1 Answers1

0

replace string with it : His followed carriage proposal entrance <br>directly had elegance. Greater for cottage gay parties natural. Remaining he furniture on he discourse suspected perpetual. <br>Power dried her taken place day ought the. Four and our ham west miss.

Phil
  • 201
  • 1
  • 7