【发布时间】:2013-10-03 07:50:51
【问题描述】:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yu.lbs"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.yu.lbs.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey=".........."
android:clickable="true"
android:enabled="true" />
</LinearLayout>
MainActivity.java:
import android.os.Bundle;
import android.view.Menu;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Activity 可以启动了。但是在 MapView 中什么都没有。可以显示地图的小网格,我认为是 MapView 自带的,但没有加载地图。有什么问题?我正在使用 Google API v3。但这段代码来自使用 API v1 的教科书。
【问题讨论】:
-
iU 是否选择了“Google API”项目构建目标?并添加这个
-
是的,我的项目下的包资源管理器中有 Google API [Android 4.3]。
-
您检查过您的互联网连接速度吗?
-
速度还可以。我可以在 Google 地图中看到地图,但在我的应用中看不到。
-
@PadmaKumar 我试过了,但地图仍然没有显示..
标签: android google-maps google-api android-mapview