Android Google Map V2在地图中心画一个十字准线 [英] Android Google Map V2 Draw a crosshair in center of map screen

查看:320
本文介绍了Android Google Map V2在地图中心画一个十字准线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用谷歌地图的android应用程序。我想在屏幕中心显示十字准线,然后想要在用户单击按钮时在中心绘制标记。所以我的问题是如何在地图上画十字线。

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.

我搜索了这个,但所有灵魂指向使用Overlay类(com.google.android.maps)十字线获得的旧google map api,但现在没有支持这个类。

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.

请帮忙

我想获得这个东西: -

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>

这篇关于Android Google Map V2在地图中心画一个十字准线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆