2
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class Map2Activity extends MapActivity {
/** Called when the activity is first created. */
MapView map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView)findViewById(R.id.mvMain);
map.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
清單文件谷歌API地圖的縮放
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="com.google.android.maps" />
main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="01VR0PIBfyfgbR5DlOlcEBPG9F5WfE7ZBPg"
android:tag="@+id/mvMain"
android:enabled="true"
android:clickable="true" />
</LinearLayout>
我沒有得到這兩個語句(forcebly關閉應用程序) 地圖=(MapView的地圖)findViewById(R.id.mvMain); map.setBuiltInZoomControls(true);
如果它必須工作我需要給我什麼?