gpt4 book ai didi

android - 更改 setMyLocationEnabled 按钮在屏幕上的位置

转载 作者:太空狗 更新时间:2023-10-29 13:21:14 28 4
gpt4 key购买 nike

在 Android 上使用 Google Maps V2 时,当我调用函数时:

googleMap.setMyLocationEnabled(true);

它在 map 的右上角给出当前位置的按钮。我想用我的自定义主题将该按钮位置更改为左下角。

我该怎么办?

最佳答案

GoogleMap mMap;
mMap.setPadding(int left, int top, int right, int bottom).

来自谷歌地图 Android API:

You can add padding around the edges of the map using the GoogleMap.setPadding() method. The map will continue to fill the entire container, but text and control positioning, map gestures, and camera movements will behave as if it has been placed in a smaller space. This results in the following changes: Camera movements via API calls or button presses (e.g., compass, my location, zoom buttons) will be relative to the padded region. getCameraPosition() will return the center of the padded region. Projection.getVisibleRegion() will return the padded region. UI controls will be offset from the edge of the container by the specified number of pixels.

关于android - 更改 setMyLocationEnabled 按钮在屏幕上的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28524579/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com