2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google Maps Android API v2 にて、マーカータッチ時にカメラを移動させない方法

Posted at

Google Maps Android API v2を利用した地図アプリにて、マーカータッチ時にカメラを移動させない方法のメモ。

以下のように、MarkerClickListenerの戻り値をtrueにすればOK。(デフォルトはfalse)
しかし戻り値をtrueにすると、InfoWindowが表示されなくなってしまう。
そこで、marker.showInfoWindow();として、明示的に呼んであげる。

.java
public static GoogleMap mMap;

mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
    @Override
    public boolean onMarkerClick(Marker marker) {
    // TODO Auto-generated method stub
        marker.showInfoWindow();
        return true;
    }
});

リファレンス
https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerClickListener

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?