public class TabMapsExample extends TabActivity { TabHost mTabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Context ctx = this.getApplicationContext(); //tab 1 mTabHost = getTabHost(); TabSpec tabSpec1 = mTabHost.newTabSpec("tab_test1"); tabSpec1.setIndicator("Map1"); Intent i1 = new Intent(ctx, MapTabView.class); tabSpec1.setContent(i1); mTabHost.addTab(tabSpec1); //tab2 mTabHost = getTabHost(); TabSpec tabSpec2 = mTabHost.newTabSpec("tab_test1"); tabSpec2.setIndicator("Map2"); Intent i2 = new Intent(ctx, MapTabView.class); tabSpec2.setContent(i2); mTabHost.addTab(tabSpec2); //tab 3 mTabHost = getTabHost(); TabSpec tabSpec3 = mTabHost.newTabSpec("tab_test1"); tabSpec3.setIndicator("Map"); Intent i3 = new Intent(ctx, MapTabView.class); tabSpec3.setContent(i3); mTabHost.addTab(tabSpec3); } }
这是地图和tabHost的使用
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/maptablayout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="#000000" android:orientation="vertical"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="50px" android:id="@+id/textview" /> <com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="" /> </LinearLayout> </RelativeLayout>
上面的红线是必须的 apiKey是每个人都有一个特定的值
mapView.getController().zoomIn();
mapView.getController().zoomOut();
mapView.getController().setZoom(...);
Intent intent = new Intent(this, MyMapActivity.class); //this is just one way of specifying it intent.putExtra(MyMapActivity.ZOOM_LEVEL_CONSTANT, 10); startActivity(intent);
在MyMapActivity onCreate(...)
Bundle retrievedData = this.getIntent().getExtras(); if (retrievedData != null) { int zoomLevel = retrievedData.getInt(ZOOM_LEVEL_CONSTANT); mapView.getController.setZoom(zoomLevel); }
有时候你可能用到
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
MapController mapController = mapView.getController();
mapController.setZoom(10);
那么如何在mapActivity加入菜单呢
其实很简单 你只要继承activity就可以了
其他的不变和activity一样
http://developer.android.com/intl/fr/guide/topics/ui/menus.html
分享到:
相关推荐
Android中MapView的使用方法.pdf 学习资料 复习资料 教学资源
接着,我希望在MapView中增加ZoomIn和ZoomOut的功能(鄙视一下Google ,缺省的MapView居然连这个功能都没有) 1. 在我们的Layout中增加一段: <LinearLayout android:id="@+id/zoom" android:layout_width="wrap_...
android 开发中的基础知识 对mapview 的掌握
使用ItemizedOverlay在mapview上创建浮动按钮,可以为坐标创建一个单击事件。
Android MapView 应用,基于Android开发,应用Android SDK 1.5
Android:如何在tab中添加mapview
garden.mapview, Mapview是一个用于显示交互式地图的Kivy小部件 MapviewMapview是一个用于显示交互式地图的Kivy小部件。 它的设计有很多的灵感,Libchamplain 和的小叶。这个小部件的目标是替换 谷歌地图 部件,即使...
NULL 博文链接:https://zhchzh1000.iteye.com/blog/800450
mapview+biee资料,mapview+biee资料,mapview+biee资料,mapview+biee资料
在android的mapview上添加浮动按钮,并固定在右下角
一款支持平移,缩放,点击事件的自定义地图控件,根据地图坐标点进行比例缩放,实现真实定位场景
NULL 博文链接:https://llhdf.iteye.com/blog/521201
android MapView地图测试,现在共享下。
使用Qt开发的,地图查看示例,只有基本功能
xml_mapView.txt
OCMapView 通过超快速组合注释自动创建集群。 它适用于任何 iOS 应用程序。 无需更改代码。 截图: 特征 快速简便! 一次处理地图上的9000 多个注释。 非常简单的用法! 无需更改代码,只需替换 MapView 类 易于...
这个是在官方的例子基础上,结合了googel api,请谨慎下载
MapView Balloons介绍: 自定义地图标注(或叫地图气泡,MapView Balloon),点击地图上的小圆点,弹出气泡,可以在气泡上加入多行文字或者图片。 测试环境: [ Eclipse 4.2, Android 3.0 以上。 注意:...