android地图定位

        mMapContraoller=mMapView.getController();

        mMapView.setTraffic(true);

第叁要修改AndroidManifest.xml文件:

    }

<uses-permission android:name=”android.permission.INTERNET” />

 

android:layout_width=”fill_parent”

        mMapView.setEnabled(true);

@Override  

/> 

public class MainActivity extends MapActivity {

activity的财富文件中填加mapview:

        

<!– 参加引用库 –>

 

        mMapView=(MapView)findViewById(R.id.MapView01);

要和谐去申请,然后加上. 

android:apiKey=”067_6YH5q7XFvCHGX8HeK9FQf9pMrzQsax4hqOw”

        mMapContraoller.animateTo(mGeoPoint);

 注意:

下边是activity的3个简单易行示例:

<!– 插足权限 –>

}

        

<uses-permission
android:name=”android.permission.ACCESS_COARSE_LOCATION” />

<uses-library android:name=”com.google.android.maps” /> 

private MapView mMapView;

然后修改Activity,注意要从MapActivity继承:

<com.google.android.maps.MapView

android:layout_height=”fill_parent”

        setContentView(R.layout.main);

<uses-permission
android:name=”android.permission.ACCESS_FINE_LOCATION” />

简不难单测试一下andriod中的地图应用,没悟出多少个微小应用也费了不少的事,记录一下,以备查.

        mMapView.setClickable(true);

    @Override

// TODO Auto-generated method stub

return false;

android:id=”@+id/MapView01″

public class MainActivity extends MapActivity { …  }

        

android:apiKey=”067_6YH5q7XFvCHGX8HeK9FQf9pMrzQsax4hqOw”

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

        super.onCreate(savedInstanceState);

        mMapContraoller.setZoom(12);

private MapController
mMapContraoller;

private GeoPoint mGeoPoint=new
GeoPoint(30659259,104065762);

 

protected boolean
isRouteDisplayed() {

    public void onCreate(Bundle savedInstanceState) {

相关文章