我有一张谷歌地图上有这些项目:
drawable3 = this.getResources().getDrawable(R.drawable.trazeicon);
但是自动地,Android在地图上绘制了图像trazeicon
的阴影,我不想拥有那个阴影。
如何删除它?
我收到错误:Syntax error, insert "}" to complete ClassBody
以下是完整代码:
package com.GPSLoc;
import java.util.ArrayList;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
public class MyItemizedOverlay extends ItemizedOverlay {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
private Context mContext;
public MyItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
}
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
public int size() {
return mOverlays.size();
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
public MyItemizedOverlay(Drawable defaultMarker, Context context) {
//super(defaultMarker);
super(boundCenterBottom(defaultMarker));
mContext = context;
}
public void clear()
{
mOverlays.clear();
}
protected boolean onTap(int index) {
OverlayItem item = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.show();
return true;
}
public void draw(Canvas canvas, MapView mapView, boolean shadow)
{
if(!shadow)
{
super.draw(canvas, mapView, false);
}
}
}
答案 0 :(得分:40)
扩展ItemizedOverlay时需要覆盖draw()
方法。像这样:
public class MyItemizedOverlay extends ItemizedOverlay {
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if(!shadow) {
super.draw(canvas, mapView, false);
}
}
....
}