gpt4 book ai didi

android - 可以删除 googlemap 上图标(项目)的阴影吗?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:06:02 25 4
gpt4 key购买 nike

我有一张 Google map ,上面有这些项目:

drawable3 = this.getResources().getDrawable(R.drawable.trazeicon);

但 Android 会自动在 map 上绘制图像 trazeicon 的阴影,而我不想有那个阴影。

如何删除它?

编辑:

我收到错误:语法错误,插入“}”以完成 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);
}
}
}

最佳答案

扩展 ItemizedOverlay 时需要覆盖 draw() 方法。像这样:

public class MyItemizedOverlay extends ItemizedOverlay {
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if(!shadow) {
super.draw(canvas, mapView, false);
}
}
....
}

关于android - 可以删除 googlemap 上图标(项目)的阴影吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4327733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com