简体   繁体   English

Recyclerview行内的GoogleMap

[英]GoogleMap inside the Recyclerview row

I have a requirement where I have to show some location with the map view beside them. 我有一个要求,我必须在旁边的地图视图中显示一些位置。 So I am planning to Put the Map view inside the row of Recycler view 所以我打算将Map视图放在Recycler视图的行中

Doing so will cost some performance issue. 这样做会导致一些性能问题。 As map takes lots of memory. 因为地图占用了大量内存。 So I am reluctant to do so. 所以我不愿意这样做。

What are other options that I am left with? 我剩下的其他选择是什么? How can I Achieve that? 我怎样才能实现这一目标? Please help me in this..... Thanks 请帮助我.....谢谢

Use Lite Mode of Google Maps for do what you need: 使用Google地图的精简模式可以满足您的需求:

Lite mode uses the same classes and interfaces as the full Google Maps Android API. Lite模式使用与完整Google Maps Android API相同的类和接口。 You can set a GoogleMap to lite mode in the following ways: 您可以通过以下方式将GoogleMap设置为精简模式:

  • Either as an XML attribute for a MapView or MapFragment 作为MapViewMapFragmentXML属性
  • Or in the GoogleMapOptions object 或者在GoogleMapOptions对象中

As an XML attribute for a MapView or MapFragment 作为MapViewMapFragmentXML属性

 <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:name="com.google.android.gms.maps.MapFragment" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" map:cameraZoom="13" map:mapType="normal" map:liteMode="true"/> 

In the GoogleMapOptions object GoogleMapOptions对象中

GoogleMapOptions options = new GoogleMapOptions().liteMode(true);

Here is an official example for displaying maps efficiently in RecyclerView using lite mode. 以下是使用lite模式在RecyclerView有效显示地图的官方示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM