Use escape characters \t (for a tab) \n (for a line break). -Kinkade
On Jan 27, 3:14 pm, Alexey <avolo...@gmail.com> wrote: > Is it possible to make TextView to break words in the middle and then > move to another line, instead moving whole word that doesn't fit to > the new line ? > I have a width and number of lines of the TextView and a long string > and want to calculate which portion of the String will fit exactly. > the code is > TextView vTextShort = (TextView) findViewById > (R.id.story_text_partial); > int lineHeight = vTextShort.getLineHeight(); > int nmbLines = mesuredHeight / lineHeight; > Paint mPaint = vTextShort.getPaint(); > String shortTextStr = mStoryText; > mStoryBreakIdx = 0; > vTextShort.setLines(nmbLines ); > int breakText = mPaint.breakText(mStoryText.toCharArray(), 0, > mStoryText.length(), mesuredWidth, null); > mStoryBreakIdx = breakText * nmbLines; > It seems to calculate number of chars accurately but not accounting > for the space that left after word is moved to a new line if it > doesn't fit fully. > And i'm looking on how to either break words in the middle or how > calculate a width of the text that will fit correctly. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---