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

百度地图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="match_parent"
android:layout_height="match_parent" >
<com.baidu.mapapi.map.MapView
android:id="@+id/bmapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="

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

被折叠的 条评论
为什么被折叠?



