使用两个GoogleMaps android

时间:2013-12-06 11:07:39

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

我正在编写使用Google Map的程序。地图上有标记。信息Winodow打开你点击标记。单击信息窗口时,新布局变为可见。有一个图片文字和专注于该标记的新小地图。但是在某些版本的android而不是小地图上它是不可见的空间。

它在4.0.1上运行良好,不适用于3.2和2. *版本。

这里是onInfoWindowClick的代码

 @Override
public void onInfoWindowClick(Marker marker) {              
    String url = markers.get(marker.getId());       
    int id = 0;
    Camera cam = null;
    id = Integer.parseInt(marker.getTitle());
    LinearLayout secondLL = (LinearLayout) findViewById(R.id.bigpicture);
    int visibility = secondLL.getVisibility();
    if(visibility == View.GONE)
    {
         secondLL.setVisibility(View.VISIBLE);           
         ImageView image = (ImageView)findViewById(R.id.badge2);
         for (int i = 0; i < camera.size(); i++)
         {
             cam = camera.get(i);
             if (cam.id == id) break;
         }

         TextView number = (TextView)findViewById(R.id.number);
         String infoNumber = "";
         if (id != 0)            
         infoNumber += "Камера №" + Integer.toString(cam.id) + ","; 
         number.setText(infoNumber);

         TextView full = (TextView)findViewById(R.id.full);
         String infoFull = "";
         if (cam.full != null)
         infoFull += cam.full + ",";
         full.setText(infoFull);

         TextView district = (TextView)findViewById(R.id.district);
         String infoDistrict ="";
         if (cam.district != null)
         infoDistrict += "Район " + cam.district;
         district.setText(infoDistrict);

         imageLoader.displayImage(url, image);  
         LatLng DOT = new LatLng(cam.lat, cam.lon);

         SupportMapFragment map2Fragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map2);
         map2 = map2Fragment.getMap();

         if (map2 != null)
         {

             map2.clear();
             map2.setTrafficEnabled(true);
             map2.setMyLocationEnabled(false);           
             map2.getUiSettings().setZoomControlsEnabled(false);
             map2.getUiSettings().setAllGesturesEnabled(false);
             Marker dot = map2.addMarker(new MarkerOptions()
                .position(DOT)                         
                .icon(BitmapDescriptorFactory
                        .fromResource(R.drawable.green)));
             map2.moveCamera(CameraUpdateFactory.newLatLngZoom(DOT, 17));
         }
    }                          
}

0 个答案:

没有答案