2012-12-05 58 views
3

我在Android上使用GoogleMap的自定義InfoWindowsAdapter。我的問題是,我無法在該自定義信息窗口上附加onLongClickListener。 GoogleMap類只有OnClickListener,但API中缺少OnLongClickListener。在Android上長按GoogleMap的InfoWindow

我試圖在我的自定義視圖上附加OnLongClickListener,但是這個監聽器沒有被調用。

private class EventInfoWindowAdapter implements InfoWindowAdapter {  
    public View getInfoWindow(Marker marker) { 

      //mWindow is clicable (I do set it in layout XML) 
     mWindow = getLayoutInflater().inflate(R.layout.event_info_window, null); 

     mWindow.setOnLongClickListener(new LinearLayout.OnLongClickListener() { 

      @Override 
      public boolean onLongClick(View view) { //THIS ONE IS NOT CALLED 

       Log.d("LONG", "CLICKED"); 

       contextMode = startActionMode(actionModeCallback); 

       return true; 
      } 
     }); 

     return mWindow; 
    } 
} 

//in onCreate(...) method 

mMap = ((MapView) findViewById(R.id.map)).getMap(); 
mMap.setInfoWindowAdapter(new EventInfoWindowAdapter()); 

任何建議如何使它工作?

+0

也有這個註冊的錯誤。查看此鏈接:[http://code.google.com/p/android/issues/detail?id=40931](http://code.google.com/p/android/issues/detail?id=40931) – Pavlos

回答