MapView显示黑屏

时间:2013-02-16 10:05:51

标签: android

我正在我的应用程序中集成谷歌地图。当我在模拟器上编译和朗读我的应用程序时,它显示我黑屏。我添加了所需的权限并在清单中添加了user-library标记,但它仍显示黑屏。这是我的代码

public class ActivityLiveMap extends MapActivity {
    private LocationManager locationManager;
    private Location location;
    private List<Overlay> overlayList;
    private GeoPoint mapPoint;
    private MapController controller;
    private MapView map;

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.activity_map);
        init();
    }

    private void init() {
        map = (MapView) findViewById(R.id.map);
        map.setBuiltInZoomControls(true);
        map.setSatellite(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

的manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.locationmeter"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="5"
        android:targetSdkVersion="10" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.LocationMeter" >
        <uses-library android:name="com.google.android.maps"/>
        <activity
            android:name="com.example.locationmeter.ActivitySplash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ActivityMenu" >
        </activity>
        <activity android:name=".ActivityCurrentLocation" >
        </activity>
        <activity android:name=".ActivityLiveMap"></activity>
    </application>

</manifest>

请帮助我,谢谢

1 个答案:

答案 0 :(得分:0)

你能确定你有:

- debug key
- internet permission
- internet enabled