Google 地圖平台即將推出新版地圖樣式。新版地圖樣式內建全新的預設調色盤,並且提升地圖體驗、改善服務的可用性。所有地圖樣式都將於 2025 年 3 月自動更新。請參閱「
Google 地圖平台新版地圖樣式 」一文,進一步瞭解適用範圍及如何提早啟用。
提供意見
控管衝突行為
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
衝突行為可控管標記在與容器衝突 (重疊) 時的顯示方式
另一個標記
設定標記的衝突行為
如要設定衝突行為,請設定
GMSAdvancedMarker.collisionBehavior
到
下列其中一項:
GMSCollisionBehaviorRequired
(預設):一律顯示標記
無論是哪種衝突,這是預設行為。不影響
顯示是否有任何其他標記或基本地圖標籤。
GMSCollisionBehaviorOptionalAndHidesLowerPriority
:僅顯示標記
沒有重疊的情況如果這個類型的兩個標記
重疊,系統會顯示 zIndex
較高的素材資源。如果兩者相同
zIndex
,顯示直向畫面位置較低的標記。
GMSCollisionBehaviorRequiredAndHidesOptional
:一律顯示標記
也可以隱藏
GMSCollisionBehaviorOptionalAndHidesLowerPriority
。僅顯示標記
沒有重疊的情況不行
GMSCollisionBehaviorRequired
。如果這個類型的兩個標記重疊
系統會顯示 zIndex
較高的位址。使用標記時,標記的衝突規則
相同的 zIndex
未定義。
注意: 為了獲得最佳衝突行為,請建立全部
相同類型的進階標記。包括進階標記
以 表示
圖示檢視 、圖示或預設功能。
Swift
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map
marker.collisionBehavior = .requiredAndHidesOptional
Objective-C
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map
marker.collisionBehavior = GMSCollisionBehaviorRequiredAndHidesOptional
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-07-26 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]
想進一步說明嗎?