简体   繁体   中英

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

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:

Lite mode uses the same classes and interfaces as the full Google Maps Android API. You can set a GoogleMap to lite mode in the following ways:

  • Either as an XML attribute for a MapView or MapFragment
  • Or in the GoogleMapOptions object

As an XML attribute for a MapView or MapFragment

 <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 options = new GoogleMapOptions().liteMode(true);

Here is an official example for displaying maps efficiently in RecyclerView using lite mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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