At the moment, the words (namely the words!) Are transferred (in the Button / TexView elements) as it were. One letter from a word can be transferred to a new line. It is about both Russian and English.

How to achieve a competent transfer automatically (WITH A SIGN OF TRANSFER! (Hyphen))?

Or at least a managed transfer in WORDS, with a hyphen?

Those. like a soft transfer <wbr>? (which doesn't work here)

Common & shy; | & # 173; | u + 00ad doesn't work either.

Html.fromHtml (...) applies.

PS It's about the app

PPS helps a bit: \ u200B
But there is no hyphenation mark.

  • Is it about speaker preview or application? - Enikeyschik 1:01
  • About the app. (Thank you, added this explanation to the question) - user_MGU
  • android studio - IDE, editor and debugger of the code itself does not affect the ability of applications written for Android OS to transfer words (the solution will be the same for any IDE and indicate one of them incorrectly in the question header) - pavlofff
  • Ok, Pavlofff ... But it is Android Studio that does not suggest a solution. And it was within the framework of Android Studio that I ran into this and did not find a solution in it, and I am looking for a solution for it. Thus, Android Studio indirectly here to mention, I think, it is quite appropriate ... Maybe this is decided by the spec. library (or special function / plugin) for Android Studio ... - user_MGU

1 answer 1

  1. I think that we need to create some abstract AbstractTextView as a successor from TextView. From which your own CustomTextView and CustomEditTextView will be inherited.

And depending on the size of the element (when calling the onMeasure method), count whether the phrase fits or not and arrange words using your own transfer algorithm.

  1. At the same time, word wrap is more about Russian. In modern English, the use of transfer on print is practically not used. The average length of an English word is not as great as in Russian, for example, therefore, in order to preserve the beauty of typing, hyphenation in English is little used today.

  2. You can read about the transfer algorithm on the wiki.

  3. This library supports text wrapping, but is no longer supported. DocumentView documentView = addDocumentView(new StringBuilder("Your long text content"), DocumentView.PLAIN_TEXT); documentView.getDocumentLayoutParams().setTextAlignment(TextAlignment.JUSTIFIED); documentView.getDocumentLayoutParams().setHyphenator(new Hyphenator(HyphenPattern.PT)); // перенос documentView.getDocumentLayoutParams().setHyphenated(true);

But, perhaps, all this information will be useful for solving the problem.