안드로이드 개발 질문/답변
(글 수 45,052)
mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.image);
customOverlay = new CustomOverlay(drawable, Map.this);
이렇게 customOverlay 에 drawable 이미지를 인자로 줘서 DefaultMarker 를 설정을 해놨습니다.
그리고 customOverlay.add(item); 해서 여러개의 마커를 맵 위에 추가를 하였습니다.
그런데 각 마커마다 다른 이미지를 갖게 하려고 customOverlay이미지를 변경하려는데
customOverlay.getItem(0).setMarker(this.getResources().getDrawable(R.drawable.something));
으로 변경을 하려 했는데 변경이 되질 않더군요
혹시 방법이나 다른 API 를 써야 하는지 아시면 답변 부탁드립니다.
drawable = this.getResources().getDrawable(R.drawable.image);
customOverlay = new CustomOverlay(drawable, Map.this);
이렇게 customOverlay 에 drawable 이미지를 인자로 줘서 DefaultMarker 를 설정을 해놨습니다.
그리고 customOverlay.add(item); 해서 여러개의 마커를 맵 위에 추가를 하였습니다.
그런데 각 마커마다 다른 이미지를 갖게 하려고 customOverlay이미지를 변경하려는데
customOverlay.getItem(0).setMarker(this.getResources().getDrawable(R.drawable.something));
으로 변경을 하려 했는데 변경이 되질 않더군요
혹시 방법이나 다른 API 를 써야 하는지 아시면 답변 부탁드립니다.
setBounds(Rect)
method must be called to tell the Drawable where it is drawn and how large it should be. 라는 부분이 있습니다.setmarker 함수를 호출하시기 전에 setbounds 한수를 호출 하시면 됩니다.