谷歌地图v2没有显示,但标记显示

时间:2014-03-14 21:56:47

标签: android google-maps actionbarsherlock

我在机器人的Google Maps v2中工作,在Sherlock Tab中:

我得到它"工作",我可以在地图上添加标记,我有所有控件,但地图永远不会加载(我不会看到街道)。当我点击标记时,街道正在显示,但我无法用手指移动任何东西。放大和缩小显示,但不起作用。

当我更改Tab并返回地图时,地图会再次消失。

这是我的代码(标签显示的标签):

public class MapPdvTabFragment extends SherlockFragment {
SupportMapFragment mMapFragment;
ArrayList<Pdv> tiendas;
private View fragmentView;

private MapView mapView;
private GoogleMap resultsMap;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    this.fragmentView = inflater.inflate(R.layout.tab_frag_map_pdv, container, false);
    return this.fragmentView;

}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    FragmentTabsPdv parent = (FragmentTabsPdv) getActivity();
    mapView = ((MapView) this.fragmentView.findViewById(R.id.map));
    try {
        MapsInitializer.initialize(getActivity());
    } catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
    }
    mapView.onCreate(null);
    resultsMap = this.mapView.getMap();
    int zoom = 14;
    CameraUpdate here = CameraUpdateFactory.newLatLngZoom(new LatLng(19.359180, -99.180901), zoom);
    resultsMap.moveCamera(here);
    tiendas = parent.getListaPdv();
    displayPdvOnMap(tiendas); // Display marker ( work well)

}
}

enter image description here

2 个答案:

答案 0 :(得分:2)

使用以下代码解决了问题:https://gist.github.com/joshdholtz/4522551

答案 1 :(得分:-1)

请检查你的api密钥和logcat。