我期望在设备旋转时提高SupportMapFragment的性能。好像该片段必须重新创建。我不确定这一点,但是当设备旋转时,必须重新加载地图块。从性能的角度来看,保留和重用整个映射片段而不必重新实例化片段是有意义的。任何深入了解这一点将不胜感激。回收Android地图V2支持地图片段旋转时
我在xml中声明了SupportMapFragment,并使用api文档中描述的SetupMapIfNeeded()。
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) {
setUpMap();
}
}
}
你有这个Partick任何地方? – 2013-02-14 14:30:42