Wird beim Klicken auf die Schaltfläche „Mein Standort“ aufgerufen
Public Methods
public
abstrakt
boolesch
onMyLocationButtonClick()
Wird beim Klicken auf die Schaltfläche „Mein Standort“ aufgerufen
Dies wird im Android-UI-Thread aufgerufen.
Verwenden Sie com.google.android.gms.location.FusedLocationProviderApi, wenn Sie den aktuellen Standort des Nutzers abrufen müssen.
Rückgaben
true, wenn der Listener das Ereignis verarbeitet hat (d.h. das Standardverhalten sollte nicht auftreten), andernfalls false (d.h. das Standardverhalten sollte auftreten). Standardmäßig wird die Kamera so bewegt, dass sie auf den Nutzerstandort zentriert ist.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-06-16 (UTC)."],[[["`GoogleMap.OnMyLocationButtonClickListener` is an interface used to handle clicks on the \"My Location\" button within a Google Map."],["The primary method, `onMyLocationButtonClick()`, is called when the button is clicked and allows custom actions to be performed before or instead of the default camera movement."],["Returning `true` from `onMyLocationButtonClick()` prevents the default behavior (centering the camera on the user's location), while returning `false` allows it."]]],["The `GoogleMap.OnMyLocationButtonClickListener` interface triggers the `onMyLocationButtonClick()` method when the \"My Location\" button is pressed. This method, executed on the UI thread, allows developers to handle the event. Returning `true` prevents the default camera movement to the user's location, while `false` allows it. For retrieving the user's location, the `FusedLocationProviderApi` is recommended.\n"]]