As part of internationalizing an Android application I have come across the need to dynamically word wrap or hyphenate at the right position.
All my strings are exte
The question is old but just found best solution for me:
I have to say i'm programming in Xamarin, so the code is in C# but should not be a problem to port into java.
I used the NHyphenator Logic (https://github.com/alkozko/NHyphenator) for Inserting SoftHyphens(UTF8 Symbol - 0x00AD) so the Textview do hyphenation at the right place.
To get Hyphenation for other languages i used the openoffice Dictionaries. e.g. i had to get Hyphenation for german-swiss language
http://extensions.openoffice.org/en/search?f[0]=field_project_tags%3A157 1. Download the extension 2. Unzip it with winrar or something else 3. Copy the hyph_xx_xx/hyph_xx_xx.dic file 4. Add new Language to the Hyphenator class
NHyphernator resource files are declared as: hyph-xx-xx.pat.txt --> content of the dic file without comments hyph-xx-xx.hyp.txt --> file which contains word-exceptions where the logic for hyphening does not give correct results
If anyone wants the portable Library for Xamarin just tell, i can upload it.
EDIT:
The breakstrategy should be set to Balanced in TExtview. API Level > 23, else don't use breakstrategy.
EDIT:
Here's the mono/xamarin code: https://github.com/sma84/NHyphenator-Mono