簡體   English   中英

切片不會通過地圖視圖加載,但會加載片段

[英]Tiles wont load with Map view but loads with fragment

我試圖在我的設備上運行這個非常簡單的應用程序(使用Maps API V2),並且由於某些原因嘗試使用MapView時運行該應用程序:

<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="(i did put the correct key)"
android:id="@+id/mvMap"/>

與java文件:

 public class MainMap extends MapActivity  {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_layout);
}
@Override
protected boolean isRouteDisplayed() {

    return false;
}

瓷磚將無法加載! 但是當我使用片段時:fragment android:id =“ @ + id / map” android:name =“ com.google.android.gms.maps.SupportMapFragment” android:layout_width =“ fill_parent” android:layout_height =“ fill_parent“ />

使用-在Java文件中擴展FragmentActivity,效果非常好...

到底是怎么回事???

請閱讀有關如何在Android中實現GoogleMaps的很好的教程http : //www.vogella.com/tutorials/AndroidGoogleMaps/article.html

如果您未發布任何錯誤消息 ,則可能有多種原因導致您的地圖不顯示。

以下是最常見的錯誤

  • 忘記設置某些權限
  • 無法正確獲取API密鑰
  • 沒有網絡連接
  • GooglePlayServices在您的設備上不是最新的

暫無
暫無

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

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