On Jan 7, 9:25 am, Latha Shivanna <latha...@gmail.com> wrote: > Hi All > > I am stuck in a very simple problem. > > I have one lengthy string & I need to draw that on the device display. > > My code is as follows: > > void ShowText(String text) { > canv = thread.mSurfaceHolder.lockCanvas(); > > if (text!= null) { > > canv.drawColor(Color.WHITE); //background color > mPaint.setColor(Color.BLACK); //font color > mPaint.setTextSize(15); //font size > canv.drawText(text, 10, 200, mPaint); > //startign at some > (10,200) coordinates , dratext > } > > unlockCanvasAndPost(canv); > } > > But the problem here is, the string is going out of the screen. I want > it to break down into multiple lines if it is too big for the screen > width. > > Can anybody show me some example to do this? Is there any other better > way than using canvas class? please do suggest. > > Thanks > Latha
use android.text.StaticLayout and one of its draw method pskink
-- 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