简体   繁体   English

Android Google Map V2在地图屏幕中央绘制十字准线

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

I am developing an android application using google maps. 我正在使用Google Maps开发一个Android应用程序。 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. 我搜索了此内容,但所有提示都指向旧的Google Map API,在其中使用Overlay类(com.google.android.maps)十字准线,但是现在不支持此类。

Please help 请帮忙

I want to acheive this thing:- 我想实现这个目标:

十字线

Thanks 谢谢

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM