更具体地说,我应该如何创建类似于Google使用的动画drawable呢?如何将一个圆圈显示为蓝色叠加层(透明度为25%或类似)?
谢谢。
其实,解决方案比我想象的要简单。
在使用Google Maps Android API v2时,GoogleMap对象有一个名为setMyLocation的方法。如果将其设置为true,则Maps API中的“我的位置”布局将被激活,并显示此蓝色省略号或指示方向的箭头。
如果需要在创建活动时自动将相机移动到用户的位置,则需要遵循本文:http://discgolfsoftware.wordpress.com/2012/12/06/google-maps-android-api-v2-mylocation-locationsource-and-event-handling/
例如,使用setMyLocationEnabled(true)设置您的地图:
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);
}
}
}
我认为您想要修改Google Maps中实现的默认属性。正如您所知,Google Maps在地图上提供了许多默认设施,例如我的位置点(市场),我的位置点周围的大圆等。
要修改Google Maps中隐藏的默认属性,请按照以下步骤进行:
1. 在Eclipse中,选择您的项目并选择DDMS(Window->OpenPerspective->DDMS)。
2. 在DDMS中,单击“FileExplorer”选项卡(在右窗口中),并在“Name”列中找到“System”。
3. 导航到“system->app->Maps.apk”,您将找到“Maps.apk”。这是Google Maps应用程序。
4. 选择“Maps.apk”,然后单击此“FileExplorer”选项卡右上角的小图标。如果您接近此图标,则可以获得“从设备中拉出文件”提示。单击此选项并将“Maps.apk”下载到您的PC目录中。
5. 在您下载的电脑上,将“Maps.apk”的文件扩展名更改为“Maps.zip”。将更改后的“Maps.zip”解压缩到“Maps文件夹”中。您可以看到Maps.apk的所有文件。
6.导航到未压缩文件夹中的res文件夹,然后您将获得当前在Google Maps中使用的所有可绘制图像和xml。
7.就是这样。这就是如何查看Google Maps资源。