开发者

Set photo as marker in map

Let's say I got the absolute path into the photo. /mnt/sdcard/....jpg

   Str开发者_StackOverflow中文版ing path = "/mnt/sdcard/....jpg";
   BitmapDrawable d = new BitmapDrawable(this.getResources(), path);
   d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());

   overlayItem.setMarker(d);

This is what i tried, however the photo does not display.

EDIT: fixed, wrong path to file.


Bitmap b = BitmapFactory.decodeFile(path);

Ok, and what about this:

Drawable d = Drawable.createFromPath(path);


Can you post your code? The way Pasha said should work. Let's say you have an image in you drawable folder named your_image, you could do like this:

        Point point = new Point();
        yourMapView.getProjection().toPixels(yourGeoPoint, point);

        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.your_image);            
        yourCanvas.drawBitmap(bmp, point.x, point.y-(your_size), null);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜