【发布时间】:2013-05-27 07:19:34
【问题描述】:
我是 android 新手,现在正在使用 Google maps v2,我使用 tabhost 来显示 Google map v2,在这个 tabhost 中我需要在不同的选项卡上显示两个 Google maps v2。当我切换选项卡黑白两个包含地图的选项卡时,它会重叠。我不知道如何解决这个问题。
//两个标签的代码都在这里
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
mMap.setMyLocationEnabled(true);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
//locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME, MIN_DISTANCE, this);
Log.e("locamanager",""+locationManager);
Criteria criteria=new Criteria(); // object to retrieve provider
String provider = locationManager.getBestProvider(criteria, true);
Location location=locationManager.getLastKnownLocation(provider);
if(location!=null){
onLocationChanged(location);
}
locationManager.requestLocationUpdates(provider, 400, 1000, this);
}
@Override
public void onLocationChanged(Location location) {
latLng = new LatLng(location.getLatitude(), location.getLongitude());
Log.e("latlng",""+latLng);
cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
mMap.animateCamera(cameraUpdate);
locationManager.removeUpdates(this);
new ReverseGeocodingTask(getBaseContext()).execute(latLng);
}
谁有解决方法请帮帮我
感谢提前
【问题讨论】:
-
使用
TabActivity?请发布一些代码。 -
以上代码我用于两个选项卡,但我使用不同的布局名称。
标签: android google-maps-android-api-2 android-maps android-maps-v2