How do I wrap drawText?

Put your problem here if it does not fit any of the other categories.

How do I wrap drawText?

Postby Muttley » Sun Apr 06, 2008 9:14 am

As you can see in the picture, I'm writing text to a transparent pop-up window via drawText. This text string comes from a sql database and so is varying in length. How can I get this to wrap to the transparent box when the string is too long? Any ideas?

Thanks

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.                                         int TEXT_OFFSET_X = 10;
  3.  
  4.                                         int TEXT_OFFSET_Y = 17;
  5.  
  6.                                         int TEXT2_OFFSET_Y = 50;
  7.  
  8.                                         canvas.drawText(selectedMapLocation.getFilm(),infoWindowOffsetX+TEXT_OFFSET_X,infoWindowOffsetY+TEXT_OFFSET_Y,getTextPaint());
  9.  
  10.                                         if(selectedMapLocation.getText().length() > 0) {
  11.  
  12.                                                 canvas.drawText(selectedMapLocation.getText(),infoWindowOffsetX+TEXT_OFFSET_X,infoWindowOffsetY+TEXT2_OFFSET_Y,getTextPaint());
  13.  
  14.                                         }
  15.  
  16. public Paint getTextPaint() {
  17.  
  18.                         if ( textPaint == null) {
  19.  
  20.                                 textPaint = new Paint();
  21.  
  22.                                 textPaint.setARGB(255, 255, 255, 255);
  23.  
  24.                                 textPaint.setAntiAlias(true);
  25.  
  26.                         }
  27.  
  28.                         return textPaint;
  29.  
  30.                 }
  31.  
  32.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Attachments
android.jpg
non-wrapping text in transparent box.
android.jpg (99.21 KiB) Viewed 726 times
Muttley
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Mar 30, 2008 4:52 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 32 guests