Android Google Map V2 Draw a crosshair in center of map screen

时间秒杀一切 提交于 2019-12-25 04:26:08

问题


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

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