Google Maps current location marker and accuracy radius overlay

牧云@^-^@ 提交于 2019-11-30 14:17:06

Actually, the solution is simpler than I thought.

When using Google Maps Android API v2, the GoogleMap object has a method called setMyLocation. If you set it to true, the my-location layout of the Maps API will be activated and it will display this blue ellipsis or an arrow indicating the bearing.

If you need to automatically move the camera to the user's location when the activity is created, you need to follow this article: http://discgolfsoftware.wordpress.com/2012/12/06/google-maps-android-api-v2-mylocation-locationsource-and-event-handling/

setup your map with setMyLocationEnabled(true) for example:

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
        // Check if we were successful in obtaining the map.
        if (mMap != null) {
            mMap.setMyLocationEnabled(true);
            mMap.setOnMyLocationButtonClickListener(this);
        }
    }
}

I think that you want to let the default attributes implemented in Google Maps modify. As you know, Google Maps provides many defaulted facilities on the map, such like My Location dot(market), A Big Circle around my location dot, etc.

To modify this defaulted attributes hidden in the Google Maps, please follow this steps;

1.In Eclipse, select your project and select DDMS(Window->OpenPerspective->DDMS).

2.In DDMS, click "FileExplorer" tab(in Right window) and find "System" in the "Name" column.

3.Navigate to the "system->app->Maps.apk" and you will find "Maps.apk". this is Google Maps app.

4.Select "Maps.apk" and click the small icon in the right-top of this "FileExplorer" tab. If you approach to this icon, you can get "Pull a file from the device" hint. Click this and download "Maps.apk" to your PC directory.

5.In your downloaded PC, change the file extension of the "Maps.apk" into "Maps.zip". Unzip the changed "Maps.zip" into the "Maps folder". You can see all the files of Maps.apk.

6.Navigate to the res folder in the unzipped folder, then you will get all drawable image and xml using in Google Maps currently.

7.That's all. This is HOW TO VIEW the Google Maps Resources.

  1. But to see all complete project file, you MUST decompile this app using the decompile Utils tool, but I don't try to explain HOW To USE this decompile toos here.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!