I have a map on which I want to place the ImageView with its tip touching the equator.I gave the attribute centerVertical=true and centerHorizontal=true to the ImageView,but it is not positioned on the equator.I got the center of the map but I want the ImageView to be positioned on the equator of the map.
Screenshot:
Code:
@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>