问题
I am developing an android application using google maps. I want to show a crosshair in center of screen and then would like to plot marker at center when user clicks button. So my question is how to draw a cross hair on maps.
I searched for this but all soultions points to old google map api where using Overlay class (com.google.android.maps) crosshair is obtained , but now there is no support for this class.
Please help
I want to acheive this thing:-
Thanks
回答1:
I've been using relative layouts to do this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<ImageView
android:src="@drawable/crosshair"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"/>
</RelativeLayout>
来源:https://stackoverflow.com/questions/39488157/android-google-map-v2-draw-a-crosshair-in-center-of-map-screen