在6.0版本中,marshmallow不能使用OnInfoWindowClickListner

时间:2017-05-22 09:07:08

标签: android google-maps

在其他版本(我在模拟器上测试)这段代码完美无缺,但就我而言(YotaPhone 2,Marshmallow),他拒绝工作。问题是

$(".col-md-8 a").click(function(){ 
    $("#hideIt").toggle();
    $(this).parent().toggleClass('col-md-12');
});

他只是停止工作。加上拒绝工作我的起点。

googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
                @Override
                public void onInfoWindowClick(Marker marker) {

                    Log.d(LOG_TAG, "onInfoWindowClick");

                    OneStationFragment oneStationFragment = new OneStationFragment();
                    LatLng currentPosition = marker.getPosition();
                    Bundle bundle = new Bundle();
                    bundle.putString("address", marker.getTitle());
                    bundle.putDouble("latitude", currentPosition.latitude);
                    bundle.putDouble("longitude", currentPosition.longitude);

                    oneStationFragment.setArguments(bundle);
                    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
                    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                    fragmentTransaction.hide(StationsMapFragment.this);
                    fragmentTransaction.addToBackStack("StationMap");
                    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
                    fragmentTransaction.add(R.id.content_frame, oneStationFragment);
                    fragmentTransaction.commit();
                }
            });

            googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
                @Override
                public View getInfoWindow(Marker marker) {
                    return null;
                }

                @Override
                public View getInfoContents(Marker marker) {
                    Log.d(LOG_TAG, "getInfoContents");

                    View v = View.inflate(getContext(), R.layout.custom_text_for_marker, null);
                    TextView title = (TextView) v.findViewById(R.id.title_marker_info);
                    TextView snippet = (TextView) v.findViewById(R.id.snippet_marker_info);
                    title.setText(marker.getTitle());
                    snippet.setText("Информация о станции");

                    return v;
                }
            });

在控制台中,我看到了这个

googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint, 10));

1 个答案:

答案 0 :(得分:0)

我拒绝了googleMap.setEnabledMyLocation(true)行,但一切都完美无缺。