Max 9000 characters in Android TextView?

淺唱寂寞╮ 提交于 2019-12-01 18:55:53

Here is a link which basically says:

The answer is "how much memory can you allocate?" Of course the system needs to allocate resources to measure and typeset and render all of that text. If it's too long, consider showing the text in pages or chunks.

So if your string has 50000 characters, show it in 9000 character chunks.

Use this on your EditText or TextView:

android:maxLength="1000000"

Some phones have an hard limit of 9000 chars by default.

For anyone looking at this in 2018, I don't think there's a hard limit. I have a pretty cheap Android phone with 1 GB of RAM and was able to both edit and display over 40,000 characters of text. There is a slight initial pause when pasting into the edit box and when rendering into a text view but otherwise it works just fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!