1、添加BMapApiDemoApp.java

2、AndroidManifest文件  application里添加  android:name=".ui.BMapApiDemoApp"

    <application android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:name=".ui.BMapApiDemoApp"
android:debuggable="true">

3、xml 布局文件里添加

 <com.baidu.mapapi.MapView
android:id="@+id/MapViewStoreInfo"
android:layout_width="fill_parent"
android:layout_height="100dip"
android:clickable="true"/>

4、java文件 继承MapActivity

override  onPause、onResume、isRouteDisplayed等函数

5、初始化地图、添加标记物

 private void initMap() {
app = (BMapApiDemoApp) this.getApplication();
if (app.mBMapMan == null) {
app.mBMapMan = new BMapManager(getApplication());
app.mBMapMan.init(app.mStrKey,
new BMapApiDemoApp.MyGeneralListener());
}
app.mBMapMan.start();
// 如果使用地图SDK,请初始化地图Activity
super.initMapActivity(app.mBMapMan); MapViewStoreInfo.getController().setCenter(setMapCenter());
marker = getResources().getDrawable(
R.drawable.map_marker); // 得到需要标在地图上的资源
marker.setBounds(0, 0, marker.getIntrinsicWidth(),
marker.getIntrinsicHeight()); // 为maker定义位置和边界 MapViewStoreInfo.getOverlays().clear();
MapViewStoreInfo.getOverlays().add(
new OverItemT(marker,StoreInfoActivity.this,setMapCenter()));
MapViewStoreInfo.invalidate();
}

6、下方添加标记物类

class OverItemT extends ItemizedOverlay<OverlayItem>{
private List<OverlayItem> mGeoList = new ArrayList<OverlayItem>(); public OverItemT(Drawable marker, Context context, GeoPoint pt) {
super(boundCenterBottom(marker)); mGeoList.add(new OverlayItem(pt, "", null)); populate();
} @Override
protected OverlayItem createItem(int i) {
return mGeoList.get(i);
} @Override
public int size() {
return mGeoList.size();
} @Override
public boolean onSnapToItem(int i, int j, Point point, MapView mapview) {
Log.e("ItemizedOverlayDemo","enter onSnapToItem()!");
return false;
}
}

最新文章

  1. 麦软社区Mindmanager现金抵用券使用流程
  2. log4net详解(转载)
  3. 【AT91SAM3S】ADC中断方式采集数据
  4. CentOS 7下源码安装MySQL 5.7
  5. php中英文截取无乱码 包括全角下的字符
  6. Spring JdbcTemplate的queryForList(String sql , Class&lt;T&gt; elementType)易错使用--转载
  7. JavaScript之简易计算器
  8. 《Programming WPF》翻译 第9章 5.默认可视化
  9. EclipseEE导入项目出现的那些问题
  10. MySQL查询1
  11. Python学习之路基础篇--05Python基础+列表和元组
  12. WPF设置软件界面背景为MediaElement并播放视频
  13. 收藏一个带动画效果的ScrollViewer以及ScrollBar的模板
  14. NoSQL还是SQL?这一篇讲清楚
  15. logback身份证脱敏
  16. yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSS&#39;Z&#39;即UTC时间,与String日期转换
  17. hdu-1394(线段树&amp;逆序数的性质和求法)
  18. Code Igniter数据库操作函数大全
  19. servlet类
  20. Eclipse 安装更多版本SDK

热门文章

  1. review33
  2. vmware centos 连网方式
  3. CodeForces - 799B-T-shirt buying (优先队列)
  4. New Concept English three (46)
  5. 详解linux互斥锁 pthread_mutex和条件变量pthread_cond
  6. stl_algo.h
  7. 重构代码 —— 函数即变量(Replace temp with Query)
  8. burpsuite使用以及repeater模块实现重放攻击
  9. 笔记:加 ly 不一定是副词
  10. Linux 优秀软件