【问题标题】:(Help Please) Type The method initilizeMap() is undefined for the type Fragment1(请帮助)类型 Fragment1 类型的方法 initilizeMap() 未定义
【发布时间】:2014-08-04 21:53:07
【问题描述】:

我使用片段创建了一个带有滑动视图的应用程序。这一切都很好。当我尝试在片段上使用谷歌地图时,问题就来了。它给了我错误:“类型 Fragment1 类型的方法 initilizeMap() 未定义”。我卡住了,请帮帮我。

片段的部分代码:

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







        try {
            // Loading map
            initilizeMap();

            // Changing map type
            googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            // googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            // googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
            // googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
            // googleMap.setMapType(GoogleMap.MAP_TYPE_NONE);

            // Showing / hiding your current location
            googleMap.setMyLocationEnabled(true);

            // Enable / Disable zooming controls
            googleMap.getUiSettings().setZoomControlsEnabled(false);

            // Enable / Disable my location button
            googleMap.getUiSettings().setMyLocationButtonEnabled(true);

            // Enable / Disable Compass icon
            googleMap.getUiSettings().setCompassEnabled(true);

            // Enable / Disable Rotate gesture
            googleMap.getUiSettings().setRotateGesturesEnabled(true);

            // Enable / Disable zooming functionality
            googleMap.getUiSettings().setZoomGesturesEnabled(true);

提前致谢。

【问题讨论】:

    标签: android methods maps fragment


    【解决方案1】:

    您应该在代码中的某个地方添加 initilizeMap(),因为这不是在某处预定义的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-29
      • 1970-01-01
      • 2016-06-07
      • 2021-06-19
      • 2014-07-14
      • 1970-01-01
      相关资源
      最近更新 更多