簡體   English   中英

Recyclerview行內的GoogleMap

[英]GoogleMap inside the Recyclerview row

我有一個要求,我必須在旁邊的地圖視圖中顯示一些位置。 所以我打算將Map視圖放在Recycler視圖的行中

這樣做會導致一些性能問題。 因為地圖占用了大量內存。 所以我不願意這樣做。

我剩下的其他選擇是什么? 我怎樣才能實現這一目標? 請幫助我.....謝謝

使用Google地圖的精簡模式可以滿足您的需求:

Lite模式使用與完整Google Maps Android API相同的類和接口。 您可以通過以下方式將GoogleMap設置為精簡模式:

  • 作為MapViewMapFragmentXML屬性
  • 或者在GoogleMapOptions對象中

作為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"/> 

GoogleMapOptions對象中

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

以下是使用lite模式在RecyclerView有效顯示地圖的官方示例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM