2015-08-27 87 views
0

我正在使用Mapbox Android SDK構建Android應用程序。我正在向地圖添加標記,如下所示。我如何定製彈出窗口,以便它可以有一個將調用導航意圖的按鈕?如何使用適用於Android的Mapbox自定義標記彈出框

LayerData.LayerFeature feature = layerDataArray.get(i).features.get(j); 
Marker m = new Marker(map, feature.name, feature.address1 
    + ", " + feature.address2 + ", " + feature.city + ", " + feature.state, 
new LatLng(feature.lat, feature.lng)); 
m.setIcon(new Icon(this, Icon.Size.MEDIUM, 
    feature.marker_symbol, feature.marker_color)); 
map.addMarker(m); 
locationItemArray.add(new LocationItem(layerDataArray.get(i).features.get(j).title, layerDataArray.get(i).features.get(j).description, 
layerDataArray.get(i).features.get(j).lat, layerDataArray.get(i).features.get(j).lng)); 

回答

-1
mapView.setOnMarkerClickListener(new MapView.OnMarkerClickListener() { 
     @Override 
     public boolean onMarkerClick(final Marker marker) { 
      materialDialog = new Dialog(getActivity(),android.R.style.Theme_DeviceDefault_Light_Dialog_NoActionBar) { 

       @Override 
       protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 

       } 
      }; 
      materialDialog.show(); 
      materialDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 
      return true; 
     } 
    }); 
+1

@OsvaldoBringaz,編輯您的代碼,並解釋是錯誤,我將能夠刪除我的下票 – IsraGab