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

I am developing an Android application using google maps. I want to show the crosshairs in the center of the screen, and then I would like to draw a marker in the center when the user clicks a button. So my question is how to draw a crosshair on the maps.

I searched for this, but all soultions point to an old google api map where the Overlay class (com.google.android.maps) cross call is used, but now there is no support for this class.

Please, help

I want to achieve this goal: -

Cross hair

thanks

0
source share
1 answer

I used relative layouts for 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> 
0
source

Source: https://habr.com/ru/post/1468794/


All Articles