如何在谷歌地图上移动地图,但保持标记为Android中的当前位置? [英] how to moves map on google map but keep marker as current location in android?

查看:101
本文介绍了如何在谷歌地图上移动地图,但保持标记为Android中的当前位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是机器人新手,我受到了最后两天的困扰。我研究了很多,但没有得到。我在地图上实现了不同的概念,但地图没有移动。它显示了当前位置,标记随着我想在地图上保留标记作为位置选择器.Marker会根据地图移动选择不同的位置。请帮助我浪费了很多时间来做到这一点。 您可以通过不同的方式做到这一点。最简单 - 将标记图像添加到 ImageView over map片段中,类似这样:

 < RelativeLayout 
android:layout_width =match_parent
android:layout_height =match_parent>

片段
android:id =@ + id / map
android:layout_width =match_parent
android:layout_height =match_parent
class =com.google.android.gms.maps.MapFragment
/>

< ImageView
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_centerInParent =true
android: src =@ drawable / marker
/>

< / RelativeLayout>

另请参阅这个问题。

I am new in android.I am suffered from last two days.I have researched lot but i didn't get.I implemented different concept in map but map is not moving.It is showing current location and marker is move with map.I want to keep marker as location picker on map.Marker will pick different location according to map moves. Please help i wasted lot of time to do this.

解决方案

You can do it by different ways. Simplest - add marker image to ImageView over map fragment, something like that:

<RelativeLayout
    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.MapFragment"
    />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/marker"
    />

</RelativeLayout>

Also take a look at this question.

这篇关于如何在谷歌地图上移动地图,但保持标记为Android中的当前位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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