Google地图中的信息窗口不显示图片 - android studio

时间:2017-07-05 07:32:11

标签: java android google-maps android-studio google-api

我一直试图在我的应用程序中显示一些信息信息窗口 - 使用谷歌地图 - 使用InfoWindowAdapter,但它只是显示任何图片,所以问题是什么?

这是我的代码

public class findonmap extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);


}

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    Bundle recevier=getIntent().getExtras();
    float a=recevier.getFloat("x");
    float b=recevier.getFloat("y");

    LatLng mycordinate = new LatLng(a,b);


    mMap.addMarker(new MarkerOptions().position(mycordinate).icon(BitmapDescriptorFactory.
                    fromResource(R.drawable.marker2)));

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

        @Override
        public View getInfoContents(Marker marker) {
           // ConstraintLayout layout=(ConstraintLayout)findViewById(R.id.indo)
            View view=getLayoutInflater().inflate(R.layout.info,null);
            return view;
        }
    });
    int zoomLevel = 4; //This goes up to 21
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mycordinate, zoomLevel));

}}

0 个答案:

没有答案