Dispaly bubble with Link, good shape as in google map,close

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Dispaly bubble with Link, good shape as in google map,close

Postby androidUser » Mon Apr 13, 2009 10:44 am

SDK 1.0
I can able to display the bubble in map as shownin in figure(bubble.bmp).


Question:

1) How to display the bubble message like in google as shown in figure(google.bmp)
2) Is it possible to add Tab / link / close in bubble as show in figure (google.bmp).
Any tutorial link ?

My Code:

private void drawInfoWindow(Canvas canvas, MapView mapView, boolean shadow) {

if ( selectedMapLocation != null) {
if ( shadow) {
// Skip painting a shadow in this tutorial
} else {
// First determine the screen coordinates of the selected MapLocation
Point selDestinationOffset = new Point();
mapView.getProjection().toPixels(selectedMapLocation.getPoint(), selDestinationOffset);

// Setup the info window with the right size & location
int INFO_WINDOW_WIDTH = 125;
int INFO_WINDOW_HEIGHT = 25;
RectF infoWindowRect = new RectF(0,0,INFO_WINDOW_WIDTH,INFO_WINDOW_HEIGHT);
int infoWindowOffsetX = selDestinationOffset.x-INFO_WINDOW_WIDTH/2;
int infoWindowOffsetY = selDestinationOffset.y-INFO_WINDOW_HEIGHT-bubbleIcon.getHeight();
infoWindowRect.offset(infoWindowOffsetX,infoWindowOffsetY);

// Draw inner info window
canvas.drawRoundRect(infoWindowRect, 5, 5, getInnerPaint());

// Draw border for info window
canvas.drawRoundRect(infoWindowRect, 5, 5, getBorderPaint());

// Draw the MapLocation's name
int TEXT_OFFSET_X = 10;
int TEXT_OFFSET_Y = 15;
canvas.drawText(selectedMapLocation.getName(),infoWindowOffsetX+TEXT_OFFSET_X,infoWindowOffsetY+TEXT_OFFSET_Y,getTextPaint());
}
}
}
Attachments
bubble.PNG
bubble.PNG (138.92 KiB) Viewed 371 times
google.PNG
google.PNG (80.06 KiB) Viewed 373 times
androidUser
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 05, 2009 1:08 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 4 guests