Android 在图像上绘制动态点

Android 在图像上绘制动态点,android,google-maps,Android,Google Maps,我正在为android编写一个室内定位应用程序,我需要在图像(地图)上显示一个点,它在地图上的位置在程序中不断更新。为此,我应该使用什么方法?创建ImageView的子类,以便您可以将地图设置为ImageView内容;然后重写onDraw()方法,该方法将为您提供一个Canvas,您可以在其上绘制任何您喜欢的内容。下面是一些伪代码来说明这个想法: public class DotImageView extends ImageView { @Override public voi

我正在为android编写一个室内定位应用程序,我需要在图像(地图)上显示一个点,它在地图上的位置在程序中不断更新。为此,我应该使用什么方法?

创建
ImageView
的子类,以便您可以将地图设置为
ImageView
内容;然后重写
onDraw()
方法,该方法将为您提供一个
Canvas
,您可以在其上绘制任何您喜欢的内容。下面是一些伪代码来说明这个想法:

public class DotImageView extends ImageView {

    @Override
    public void onDraw(Canvas c) {
        //Call super for default behavior (draw the image first)
        super.onDraw(c);

        //Then draw your dot anywhere you like
        c.drawCircle(...);
    }

}

HTH

您想在地图上显示3D点(根据您的问题)

所以,我建议您通过扩展覆盖类在地图上绘制覆盖图,并在位置更新时通过在draw方法中向覆盖图列表添加新覆盖图来绘制新的点图像。编写方法,该方法提供更新的位置,以绘制方法,该方法使用可用于从lat、long绘制精确位置的地质点和点类获取精确点。 如果有帮助,我将不胜感激