android 地图网格,谷歌地图Android中只显示网格

我想实现谷歌地图,但我现在面临的一些问题的。 问题是,当我加载我的应用程序时,它只显示地图的网格(而不是地图的图像)。谷歌地图Android中只显示网格

这里是我的代码...任何人都可以看到这个问题?

的Xml主要

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/hello" />

xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/map_view"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:apiKey=" api key"

android:clickable="true"

android:enabled="true" />

清单文件

package="info.org.NewMap"

android:versionCode="1"

android:versionName="1.0" >

android:icon="@drawable/ic_launcher"

android:label="@string/app_name" >

android:name=".NewMapActivity"

android:label="@string/app_name" >

的Java类

package info.org.NewMap;

import android.os.Bundle;

import com.google.android.maps.MapActivity;

import com.google.android.maps.MapView;

public class NewMapActivity extends MapActivity {

/** Called when the activity is first created. */

private MapView mapView;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

mapView = (MapView) findViewById(R.id.map_view);

mapView.setBuiltInZoomControls(true);

}

@Override

protected boolean isRouteDisplayed() {

// TODO Auto-generated method stub

return false;

}

}

其次Java文件

package info.org.NewMap;

import java.util.ArrayList;

import android.app.AlertDialog;

import android.content.Context;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;

import com.google.android.maps.OverlayItem;

public class CustomItemizedOverlay extends ItemizedOverlay {

private ArrayList mapOverlays = new ArrayList();

private Context context;

public CustomItemizedOverlay(Drawable defaultMarker) {

super(boundCenterBottom(defaultMarker));

}

public CustomItemizedOverlay(Drawable defaultMarker, Context context) {

this(defaultMarker);

this.context = context;

}

@Override

protected OverlayItem createItem(int i) {

return mapOverlays.get(i);

}

@Override

public int size() {

return mapOverlays.size();

}

@Override

protected boolean onTap(int index) {

OverlayItem item = mapOverlays.get(index);

AlertDialog.Builder dialog = new AlertDialog.Builder(context);

dialog.setTitle(item.getTitle());

dialog.setMessage(item.getSnippet());

dialog.show();

return true;

}

public void addOverlay(OverlayItem overlay) {

mapOverlays.add(overlay);

this.populate();

}

}

2012-06-22

Youddh

+0

你给正确的地图API密钥 –

+0

是你是对的问题是API密钥.. –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值