こんにちは私は少量のピンオーバーレイを持つ小さな地図アプリを作った。問題は、ピンが最初の画面にないときに来るので、アプリケーションは決してそれらを描画しません。マップマーカーを生成
たとえば、point3とpoint2を見ることができないanimateTO(point1)の場合はマップに表示されませんが、animateTo(point2)なら他のピンは決して地図に表示されません画面に表示される点を描画するだけです。なぜこれが起こることができるの任意のアイデア?
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.indicador_mapa);
ContactItemizedOverlay itemizedoverlay = new ContactItemizedOverlay(drawable, this);
//first point of location
//oficina central
String coordinates[] = {"-16.50355741", "-68.13074811"};
//prado cerca a las gradas
String coordinates1[] ={"-16.50120505", "-68.13334501"};
//calle murillo y oruro
String coordinates2[] ={"-16.449587", "-68.136130"};
//san miguel
String coordinates3[] ={"-16.540237", "-68.078138"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
double lat1 = Double.parseDouble(coordinates1[0]);
double lng1 = Double.parseDouble(coordinates1[1]);
double lat2 = Double.parseDouble(coordinates2[0]);
double lng2 = Double.parseDouble(coordinates2[1]);
double lat3 = Double.parseDouble(coordinates2[0]);
double lng3 = Double.parseDouble(coordinates2[1]);
GeoPoint point = new GeoPoint((int) (lat * 1E6),
(int) (lng * 1E6));
GeoPoint point1 = new GeoPoint((int) (lat1 * 1E6),
(int) (lng1 * 1E6));
GeoPoint point2 = new GeoPoint((int) (lat2 * 1E6),
(int) (lng2 * 1E6));
GeoPoint point3 = new GeoPoint((int) (lat3 * 1E6),
(int) (lng3 * 1E6));
OverlayItem overlayitem = new OverlayItem(point, "oficina1", "Agencia calle Batallón Colorado");
OverlayItem overlayitem1 = new OverlayItem(point1, "oficina2", "Agencia calle camacho #2135");
OverlayItem overlayitem2 = new OverlayItem(point2, "oficina3", "agencia Calle Murillo");
OverlayItem overlayitem3 = new OverlayItem(point3, "oficina4", "Agencia san miguel calle 21 esquina montenegro");
//add the itemized overlay to the list of itemized overlays
itemizedoverlay.addOverlay(overlayitem);
itemizedoverlay.addOverlay(overlayitem1);
itemizedoverlay.addOverlay(overlayitem2);
itemizedoverlay.addOverlay(overlayitem3);
mapOverlays.add(itemizedoverlay);
mapControler = mapView.getController();
mapControler.animateTo(point);
mapControler.setZoom(16);
// MyLocationOverlay mLocationOverlay = new MyLocationOverlay(getBaseContext(), mapView);
// mapControler.animateTo(mLocationOverlay.getMyLocation());
応答に感謝します。あなたのコードについて、他の答えでは、これが画面上にない点の問題を解決するところで、私がこのコードで見る唯一の違いは、それらがデータベースから追加されたことです。答えにつけなかった。私は、最初の画面に表示されるピンだけが描かれている場合の解決法にどのようにアプローチするのかを知りたいのですが、もう少し詳しく説明すると得られません。そのリンクの –
にはforloop(setoflocations)があり、コード内の地理的ポイントのarraylistを作成するだけで、それをforループとして使用できます。 –
これはジオポイントを1つずつ追加するよりも簡単ですが、偉大で効果的ですが、私の問題は解決しません。最初の画面の外にあるジオポイントは描画されません。 –