kakaoMap.setOnInfoWindowClickListener { _, infoWindow, guiId ->
Log.d("InfoWindowDebug", "Clicked guiId = $guiId")
Log.d("InfoWindowDebug", "infowindowId Id = ${infoWindow.id}")
if (guiId == "detailButton") {
Toast.makeText(requireContext(), "상세보기 버튼 클릭!", Toast.LENGTH_SHORT).show()
}
}
private fun createCustomInfoWindow(label: Label, hospital: MedicalInstitutionDto): InfoWindowOptions {
val body = GuiLayout(Orientation.Vertical)
body.setId("bodyGuiId")
body.setPadding(30, 30, 30, 30)
val bgImage = GuiImage(R.drawable.rounded_white_background_shadow_strong, false)
bgImage.setFixedArea(20, 7, 7, 7)
body.setBackground(bgImage)
val typeText = GuiText(hospital.medicalInstitutionType ?: "병원").apply {
setTextSize(25)
setId("typeText")
setAlign(Vertical.Top, Horizontal.Left)
setPadding(0, 4, 0, 4)
}
val detailText = GuiText("상세 보기").apply {
setId("detailButton")
setTextSize(25)
setTextColor(0xFF666666.toInt())
setAlign(Vertical.Center, Horizontal.Center)
setPadding(10, 10, 10, 10)
}
body.addView(detailLayout)
우선 이렇게 셋팅을 하고
인포윈도우 커스텀하는 작업 중에 “상세보기” 라는 버튼을 만들어서 아이디 값 set을 해주고 클릭리스너로 이벤트 진행을 하려고 하는데 텍스트 부분클릭하면 눌값으로 넘어오고 텍스트 아닌부분 클릭하면 bodyId는 넘어오드라구요
그래서 궁금한게 세부 아이템들은 아이디 넘기는게 불가능한가요???
[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.