百度地图点击地图显示所选位置与自定义回到定位按钮

这篇博客介绍了如何在百度地图中实现点击地图显示所选位置的详细信息,并添加自定义的回到定位按钮。文章强调了百度地图API中没有内置此功能,需要开发者自行编写代码。提到了关键布局和服务配置,指出缺少特定service会导致返回当前位置功能失效。最终展示了实现后的效果。
摘要由CSDN通过智能技术生成

第一篇博客,,近期遇到一个关于地图选点显示地理位置与自定义回到定位按钮的需求,  以前做过,也是参考大神们的经验,之所以写出来就是为了把遇到的坑写一下,文笔不好,请谅解


百度地图api 貌似是没有显示这个定位按钮的,只能自己写,


布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:top="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <TextView
            android:text="城市:"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView 
            android:text="佛山市"
            android:id="@+id/city_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            />
        
       
    </LinearLayout>
     <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <TextView
            android:text="地址:"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView 
            android:text="佛山市南海桂城镇"
            android:id="@+id/address_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            />
       
        
    </LinearLayout>
    
    <RelativeLayout 
    android:layout_width&#
  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值