我試圖在我的應用程序上顯示一個基本的谷歌地圖,但這不起作用它顯示一個白色屏幕,而不是我有一個網絡連接,我也檢查我的MANEFIST一百次,我genub deubg鍵,並確定它是真的安卓空白頁上的谷歌地圖(白色)
我想如果有人可以帶領我什麼做錯了?
我也沒有修改代碼,但在EMULATOR上第二次顯示地圖並且在我的設備上它並不突然顯示在模擬器上的AT ALL上。
public class MyMapDisplayActivity extends MapActivity {
MapController MControl;
GeoPoint GeoP;
MapView mapview;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Map
MapView mapview = (MapView) findViewById(R.id.mapview);
mapview.displayZoomControls(true);
mapview.setBuiltInZoomControls(true);
double lat = 19.7888;
double longi = 52.535;
GeoP = new GeoPoint ((int) (lat *1E6),(int) (longi *1E6));
MControl = mapview.getController();
MControl.animateTo(GeoP);
MControl.setZoom(14);
MyLocationOverlay LocationOverlay = new MyLocationOverlay(this, mapview);
mapview.getOverlays().add(LocationOverlay);
LocationOverlay.enableCompass();
LocationOverlay.enableMyLocation();
}//onCreate
//Map
@Override
protected boolean isRouteDisplayed() {
return false;
}
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tab2"
android:orientation="vertical"
android:paddingTop="60px"
>
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0jiwJEbT6if6dhaf0x6Fr_zRLsrz_CYxcLGj6pQ"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jdisplay.map"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BatteryprojectActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
你可以發佈你的清單,你的佈局和活動代碼? – Chiara
編輯我的帖子提前致謝 – mabalowsho