TextView 的长度是否有限制

Is there a limitation in length of TextView

我正在开发 Android 应用程序,我正在将一些达到 20,653 字节的字符串放入 TextView。

当我在 API 22 设备上构建和执行时,它可以工作。但是,在 API 26 设备上构建时,会出现如下所示的 IndexOutOfBoundsException 错误。

Caused by: android.view.InflateException: Binary XML file line #61: Binary XML file line #61: Error inflating class TextView
                      Caused by: android.view.InflateException: Binary XML file line #61: Error inflating class TextView
                      Caused by: java.lang.IndexOutOfBoundsException

如何解决这个错误?我必须及时显示这段文字。

我就是这样解决的。

将文本(在html中形成)保存在String变量中,然后,

    tvContent.setText(Html.fromHtml(html1));

刚用strings.xml的时候没用