【发布时间】:2017-06-27 10:46:22
【问题描述】:
我有一个地图片段,我用从 API 下载的一些标记填充它,我在片段顶部添加了一个 SearchView,现在我想按标题或片段搜索标记。并在键入时显示与查询匹配的项目列表。然后通过点击一个项目删除所有其他标记并放大点击的标记。
我该怎么做?
fragment_map.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.abed.whitelabel.Fragments.CustomersFragment">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.SearchView
android:id="@+id/map_search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></android.support.v7.widget.SearchView>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</FrameLayout>
【问题讨论】:
标签: android google-maps searchview