Java 在android应用程序中测试google地图视图的功能
您好,谢谢您的关注。我正在开发我的第一个android应用程序。在其中一个标签中,我想要一个功能版的谷歌地图。正如你所看到的,我正在路上。但是,我不知道如何放大/键入地址,以便使用模拟器进行导航等,以查看它是否正常工作 以下是布局xml:Java 在android应用程序中测试google地图视图的功能,java,android,eclipse,android-emulator,android-mapview,Java,Android,Eclipse,Android Emulator,Android Mapview,您好,谢谢您的关注。我正在开发我的第一个android应用程序。在其中一个标签中,我想要一个功能版的谷歌地图。正如你所看到的,我正在路上。但是,我不知道如何放大/键入地址,以便使用模拟器进行导航等,以查看它是否正常工作 以下是布局xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" a
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/myMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="myapikey"
/>
</LinearLayout>
要启用缩放,应执行以下操作:
public class MapsActivity extends MapActivity {
private MapView map;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps_layout);
map = (MapView) findViewById(R.id.map);
map.setBuiltInZoomControls(true);
}
我不确定导航是否正确,是否需要覆盖
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
是,因此无法显示到搜索位置的路线
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView myLocationText = (TextView) findViewById(R.id.myLocationText);
setContentView(R.layout.map);
//make available zoom controls
mapView.setBuiltInZoomControls(true);
// zoom 1 is top world view
controller.setZoom(17);
}
还可以使用最后一行硬编码地图启动时的缩放
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView myLocationText = (TextView) findViewById(R.id.myLocationText);
setContentView(R.layout.map);
//make available zoom controls
mapView.setBuiltInZoomControls(true);
// zoom 1 is top world view
controller.setZoom(17);
}