MapView.LayoutParams コンストラクターに x 座標と y 座標を追加したとき。その MODE_VIEW 動作はなくなります。x座標とy座標とともにこの動作が必要です。なぜこれが起こっているのか、私は問題を抱えていません。
public void addMarkerToMAp(GeoPoint geoPoint) {
mapView.removeAllViews();
final ImageView view = new ImageView(mapView.getContext());
view.setImageResource(R.drawable.map_marker_anim);
view.post(new Runnable() {
@Override
public void run() {
AnimationDrawable animationDrawable = (AnimationDrawable) view.getDrawable();
animationDrawable.start();
}
});
mapView.addView(view);
MapView.LayoutParams layoutParams = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
MapView.LayoutParams.WRAP_CONTENT,
geoPoint,
MapView.LayoutParams.MODE_VIEW);
view.setLayoutParams(layoutParams);
}
だから、私はgeoPointを
geoPoint = mapView.getProjection().fromPixels((int)event.getX(), (int)event.getY()); イベントはクリックイベントです。
また、(event.getX()、event.getY())でマーカーピンを表示したいのですが、クリックの下に表示されます。