How to attach a flexible marker on map something like Uber and Lyft?

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:09:41
mhdtouban

edited:

Ok i solved my problem.

first : add an imageview to the same layout and position equal to center. second: to get the coordinate of the center of the map use the following approach

1- get viewgroup ( FrameLayout ) in my case where the map fragment is located.

FrameLayout myContainer = (FrameLayout) findViewById(R.id.content_frame);
int mapHeight = myContainer.getHeight();
int mapWidth = myContainer.getWidth();

2- use setOnCameraChangeListener and on camera change get the coordinates:

LatLng center = mMap.getCameraPosition().target;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!