Open GoogleCodeExporter opened 8 years ago
Hmmm... maybe ShapeDrawables don't work in ItemizedOverlay. What happens if you
pull a regular icon from the resources and use that as the marker? Does that
work?
Original comment by kurtzm...@gmail.com
on 17 Jun 2013 at 9:44
png icon is drawn correctly. I think that in Android drawable is just drawable
no matter what is its source.
Original comment by lukas.vy...@gmail.com
on 18 Jun 2013 at 7:21
Original comment by kurtzm...@gmail.com
on 21 Jun 2013 at 12:15
To use ShapeDrawables (or possibly other drawables that aren't BitmapDrawable)
you will need to turn off safe canvas drawing for the ItemizedOverlay. You can
do this by calling mItemizedOverlay.setUsingSafeCanvas(false).
Also update to the latest trunk which includes a fix for ItemizedOverlay.
Original comment by kurtzm...@gmail.com
on 21 Jun 2013 at 12:17
Tried Drawable with locationOverlay.setUseSafeCanvas(false) on 3.0.11 from
trunk and still got no icons.
Then i tried to make a ShapeDrawable created programatically and result is the
same. Any headsup on the progress on this issue?
Original comment by gav...@gmail.com
on 25 Jul 2013 at 3:17
I see you called the overlay locationOverlay - I just want to make sure you are
setting setUseSafeCanvas(false) on the ItemizedOverlay and not the
MyLocationOverlay by accident. Also try setting setUseSafeCanvas(false) on the
MapView itself to see if that works.
I may just put in a check for instanceof BitmapDrawable in ItemizedOverlay and
if that doesn't pass then call getUnsafeCanvas() and call the draw inside that
handler.
Original comment by kurtzm...@gmail.com
on 25 Jul 2013 at 3:47
setUseSafeCanvas(false) on the MapView works, it displays drawable shapes,
however they are drawn above their real position. All the itemizedOverlayItem
are drawn above their real position, actually. So it might not be a good option.
setUseSafeCanvas(false) on the ItemizedOverlay does not solve anything :(
Thanks anyway for your advice.
Original comment by waeselyn...@gmail.com
on 19 Aug 2013 at 11:48
Did you set your Hotspot correctly? You likely want Hotspot.CENTER.
Original comment by kurtzm...@gmail.com
on 19 Aug 2013 at 2:43
I finally opted for using an image to avoid to loose too much time, but yes, I
used to set up hotspot. kinda weird issue :-/
Original comment by waeselyn...@gmail.com
on 20 Aug 2013 at 9:09
You can make BitmapDrawable from xml resource by drawing it on temporary
canvas.
private Drawable toBitmapDrawable(Drawable anyDrawable){
Bitmap bmp = Bitmap.createBitmap(anyDrawable.getIntrinsicWidth(), anyDrawable.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bmp);
anyDrawable.setBounds(0, 0, anyDrawable.getIntrinsicWidth(), anyDrawable.getIntrinsicHeight());
anyDrawable.draw(canvas);
return new BitmapDrawable(getResources(), bmp);
}
Then use BitmapDrawable for overlay instead of xml resource.
Drawable marker =
toBitmapDrawable(getResources().getDrawable(R.drawable.marker));
ItemizedIconOverlay<OverlayItem> overlay = new ItemizedIconOverlay<OverlayItem>(
new ArrayList<OverlayItem>(), marker, null,
new DefaultResourceProxyImpl(this));
Original comment by sergey.alexeev@gmail.com
on 5 Apr 2014 at 11:39
Original issue reported on code.google.com by
lukas.vy...@gmail.com
on 17 Jun 2013 at 7:34