我正在使用谷歌地图,我需要更改“我的位置”的位置(当前位置按钮)。目前当前位置按钮位于右上角。所以请帮助我如何在谷歌地图屏幕上重新定位当前位置按钮。提前致谢。
我的示例代码:
final GoogleMap googleMap = mMapView.getMap();
googleMap.setMyLocationEnabled(true);
最佳答案
你可以用这个
View locationButton = ((View) mMapView.findViewById(Integer.parseInt("1")).getParent()).findViewById(Integer.parseInt("2"));
RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) locationButton.getLayoutParams();
// position on right bottom
rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
rlp.setMargins(0, 180, 180, 0);
关于java - 如何使用 android studio 更改 Google map 中“我的位置”按钮的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36785542/