Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含多行的长字符串,并且行数因所使用的 Android 设备的大小而异。有没有办法知道文本换行到多少行?
您可以使用Layout类之一:
Layout layout = new StaticLayout(text, /* other stuff--see docs */); int nLines = layout.getLineCount();