Is there anyway to automatically make a TextView go to a new line after a certain amount of characters?
I can do this programmatically, but it is really inefficient, and also time consuming if I ever need to do it for multiple TextViews.
I wan开发者_如何学Ct a TextView to go to a new line after 15 characters, every 15 characters. I tried using android:maxLength="15"
but that just stopped the string at 15 characters. No new line or anything.
Use android:maxEms
to specify a maximum amount of characters in conjunction with android:singleLine="false"
.
The only solution that I know of is going to be doing it programmatically. Since you worry about having to do it on multiple TextViews I would create a class that sublcasses TextView. Inside there do your logic to break to a new line on every 15th character. You can then use this new TextView in your layouts.
精彩评论