如何重新定位内置变焦控制在图形页面?变焦、图形、页面

2023-09-04 23:55:43 作者:烟织青萝梦

我需要把内置的图形页面的缩放控制到位,从默认的位置不同。 虽然很容易使用getZoomControls()方法来完成,这种方法是pcated在最近的API版本去$ P $。

I need to place built-in zoom controls of MapView into position different from the default position. While it's easy to do using getZoomControls() method, this method is deprecated in recent API versions.

有没有人有想法如何做到这一点的不调用getZoomControls()?

Does anyone has idea how to do this without calling getZoomControls()?

推荐答案

我有一个答案。我设法与这code在左下角,而不是在中间

I have an answer to this. I managed to reposition it with this code in the bottom left corner instead of in the middle

FrameLayout.LayoutParams zoomParams = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
ZoomControls controls = (ZoomControls) getZoomButtonsController().getZoomControls();
controls.setGravity(Gravity.LEFT);
controls.setLayoutParams(zoomParams);