[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.
https://devtalk.kakao.com/t/faq-api/125610
private fun setPlaceDrawableLabel(
latLng: LatLng,
drawableImage: Int,
anchorPointX: Float = 0.5f,
anchorPointY: Float = 0.5f,
tag: Any,
labelId: String = "",
isNewReview: Boolean,
isBookmark: Boolean
) {
val animation = LabelTransition.from(Transition.Scale, Transition.None)
val label = mKakaoMap?.labelManager?.layer?.addLabel(
LabelOptions.from(labelId, latLng)
.setStyles(
LabelStyle.from(drawableImage)
.setApplyDpScale(false)
.setAnchorPoint(anchorPointX, anchorPointY)
.setIconTransition(animation)
)
.setTag(tag)
)
if (isNewReview) {
setBadge(label, isBookmark)
changeBadge(label, isBookmark)
}
}
…
private fun setBadge(label: Label?, isBookmark: Boolean) {
val badges = label?.addBadge(
BadgeOptions
.from(R.drawable.ico_red_dot)
.setOffset(
0.5f, PlaceGlobal.setBadgeYOffset(
isSelected = true,
isBookmark = true
)
)
.setId("test1"),
BadgeOptions
.from(R.drawable.ico_red_dot)
.setOffset(
0.5f, PlaceGlobal.setBadgeYOffset(
isSelected = true,
isBookmark = false
)
).setId("test2")
)
badges?.let {
for(badge in badges) {
badge.show()
}
}
}
…
private fun changeBadge(label: Label? ,isBookmark: Boolean = false, ) {
label?.hideStyleBadge("test1")
label?.hideStyleBadge("test2")
}
위 코드처럼 Label생성 후 Badge를 추가 했습니다. 그리고 특정 이벤트가 일어나면 Boolean값에 따라서 특정 Badge를 hide()를 해주려고 했지만 hideStyleBadge(), hideAllStyleBadge() 이 두개의 메서드가 작동을 하지 않습니다…