MapView not returning to normal state after clicking toggle switch

后端 未结 2 887
既然无缘
既然无缘 2021-01-24 10:08

I\'m trying to get my map view to return to the normal style when I flick the switch within my fragment to the the OFF position but it\'s not working. The following is what occu

2条回答
  •  伪装坚强ぢ
    2021-01-24 10:38

    The else of this part:

                if(isChecked){
                    boolean success = mGoogleMap.setMapStyle(new MapStyleOptions(getResources()
                            .getString(R.string.style_json)));
    
                    if (!success) {
                        Log.e("TabFragmentMap", "Style parsing failed.");
                    }
                }else{
                    // What goes here?
                    // mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
                }
    

    You need to uncomment it

                else {
                    // What goes here?
                    mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
                }
    

提交回复
热议问题