如何在osmdroid中显示当前位置指针? [英] How to display the current position pointer in osmdroid?

查看:82
本文介绍了如何在osmdroid中显示当前位置指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 osmdroid 显示当前位置指针.

I would like to display the current position pointer using osmdroid.

getController().setCenter(new GeoPoint(location));

此代码不显示指针.那么 osmdroid 是否有内置于谷歌地图的东西?

This code does not display the pointer. So is there anything built in for osmdroid as it is for google maps?

推荐答案

你需要添加一个 MyLocationOverlay 类似下面的东西.

You need to add a MyLocationOverlay somthing like the following.

        mMyLocationOverlay = new MyLocationOverlay(this, mOsmv,
                mResourceProxy);
        mMyLocationOverlay.disableMyLocation(); // not on by default
        mMyLocationOverlay.disableCompass();
        mMyLocationOverlay.disableFollowLocation();
        mMyLocationOverlay.setDrawAccuracyEnabled(true);
        mMyLocationOverlay.runOnFirstFix(new Runnable() {
            public void run() {
                mOsmvController.animateTo(mMyLocationOverlay
                        .getMyLocation());
            }
        });
        mOsmOverlays.add(mMyLocationOverlay);

这篇关于如何在osmdroid中显示当前位置指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆