【发布时间】:2018-04-06 00:08:45
【问题描述】:
我有以下地图,以及使用 OnCameraIdleListener 将相机居中时获得的地址,但正如您在图像中看到的那样,您获得的是标记中心的地址,而不是您想要的底部。 我很感激任何建议。对不起我的英语
图片中的地址应该是“sucre ...”而不是 L.Jaimes ......
@Override
public void onCameraIdle() {
Log.i(TAG, "onCameraIdle");
LatLng position = mMap.getCameraPosition().target;
if (position != null) {
mCurrentLocation.setLatitude(position.latitude);
mCurrentLocation.setLongitude(position.longitude);
retrieveAddress(position);
}
}
我的地图片段
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
tools:context="com.mobifire.edwin.mobifire.UserMaps" />
<ImageView
android:id="@+id/imvCurrentMarker"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_a_marker" />
</RelativeLayout>
【问题讨论】:
标签: java android google-maps android-layout google-maps-markers