¡@

Home 

2014/10/16 ¤W¤È 08:25:47

android Programming Glossary: tempstr

How to get height of text with fixed width and get text length which fits in a frame?

http://stackoverflow.com/questions/4322339/how-to-get-height-of-text-with-fixed-width-and-get-text-length-which-fits-in-a-f

. EDIT See if this code is useful I haven't compiled it because I don't have android SDK here String myText String tempStr int startIndex 0 int endIndex 0 calculate end index that fits endIndex myPaint.breakText myTest true frameWidth null 1 substring.. end index that fits endIndex myPaint.breakText myTest true frameWidth null 1 substring that fits into the frame tempStr myText.substring startIndex endIndex while endIndex myText.length 1 draw or add tempStr to the Frame at this point set.. that fits into the frame tempStr myText.substring startIndex endIndex while endIndex myText.length 1 draw or add tempStr to the Frame at this point set new start index startIndex endIndex 1 substring the remaining of text tempStr myText.substring..