[ 안드로이드 - 코틀린 ] KakaoMap API marker 이벤트 처리하기
2023. 2. 9. 18:06ㆍAndroid
오늘의 할일 - 카카오 API 이용하며 지도에 있는 마커 이벤트 처리하기
어댑터에서 만든 이밴트와 함수이다
// 클릭시 해당 값을 위치로 지도 이동 후 마커 출력
holder.stateMove.setOnClickListener {
mapView.setZoomLevel(0, false)
mapView.setCalloutBalloonAdapter(CustomBalloonAdapter(mainActivity.layoutInflater, position, roomList))
makerEvent(roomList[position].roomName, roomList[position].latitude, roomList[position].longitude, position)
}
fun makerEvent(itemName: String, latitude: Double, longitude: Double, position: Int) {
mapView.removeAllPOIItems()
Log.d("makerEvent", "${position}")
marker.itemName = itemName
marker.mapPoint = MapPoint.mapPointWithGeoCoord(latitude, longitude)
mapView.setMapCenterPoint(MapPoint.mapPointWithGeoCoord(latitude, longitude), true)
marker.markerType = MapPOIItem.MarkerType.CustomImage
marker.customImageResourceId = R.drawable.vec2
marker.isShowCalloutBalloonOnTouch = false
marker.isCustomImageAutoscale = true
marker.setCustomImageAnchor(0.5f, 1.0f)
mapView.addPOIItem(marker)
Log.d("makerEvent", "marker_event")
}
'Android' 카테고리의 다른 글
[안드로이드] - Activity LifeCycle (0) | 2023.02.19 |
---|---|
[안드로이드] - 4대 컴포넌트 (0) | 2023.02.19 |
[안드로이드 - 코틀린] Spinner 자동 실행 문제 (0) | 2023.02.09 |
[ 안드로이드 - 코틀린 ] RecyclerView 클릭 위치를 Fragment에서 확인하기 (0) | 2023.02.09 |
[ 안드로이드 - 코틀린 ] Dialog에 RatingBar 추가하기 (0) | 2023.01.28 |