【发布时间】:2017-02-28 17:03:48
【问题描述】:
我有一张地图,我想在其上放置 ImageView,使其尖端接触赤道。我将属性 centerVertical=true 和 centerHorizontal=true 赋予 ImageView,但它没有定位在赤道上。我得到了中心地图,但我希望 ImageView 位于地图的赤道上。
截图:
代码:
@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
googleMap.getUiSettings().setZoomControlsEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
//center of map
LatLng centerOfMap=this.googleMap.getCameraPosition().target;
}
marker_view.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/marker_icon_view"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="162dp"
android:contentDescription="@string/app_name"
android:src="@drawable/marker" />
</RelativeLayout>
【问题讨论】:
标签: android dictionary