绪论
好久没写博客了,最近比较忙,闲下来写写博客,把小编最近用过的东西跟大家分享一下,记得上次写过一篇百度地图实现定位功能的博客,今天给大家分享一下定位之后获取周边地理位置的实现。
如果你还不知道怎么定位,看一下这里:
Android 轻松实现百度地图定位
好了先看一下实现效果怎么样吧?
实现
1.布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/height_top_bar"
android:background="@color/common_top_bar_dark"
android:gravity="center_vertical">
<Button
android:id="@+id/btn_location_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@drawable/back"
android:text="@string/top_back"
style="@style/btn_title_bar"
android:layout_alignParentLeft="true"
android:onClick="back"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/location_message"
style="@style/txt_titlebar_message"/>
<Button
android:id="@+id/btn_location_ok"
android:layout_width="52dp"
android:layout_height="match_parent"
android:layout_alignParentRight&#