当到了自我定位界面时,会自动弹出一个窗体,百度称它为pupopOverlay,效果图如下:
1、先定义一个窗体
/**
* 定位后自动弹出popOverlay窗体
* @return void
*/
private void initPopupOverLay() {
Bitmap[] bmps = new Bitmap[3];
try {
bmps[0] = BitmapFactory.decodeStream(getResources().getAssets().open("locate_near.png"));
bmps[1] = BitmapFactory.decodeStream(getResources().getAssets().open("locate_mylocation.png"));
bmps[2] = BitmapFactory.decodeStream(getResources().getAssets().open("locate_route.png"));
popup.showPopup(bmps,Geo, 12);//窗体显示在定位中心点上面
popupisshow=true;
dialog.dismiss();
Log.i("initPopupOverLay","popupwindow show");
} catch (IOException e) {
Log.i("initPopupOverLay","IOException");
e.printStackTrace();
}catch(Exception e){
Log.i("initPopupOverLay","Exception");
e.printStackTrace();
}
}
2、弹窗中每一个组件单击事件,点击中间“我的位置”显示我的位置,右边是路线规划,左边是周边搜索
//定义弹出popOverlay窗体及其单击事件
popup = new PopupOverlay(MyLocation.mMapView,new PopupClickListener() {
@Override
public void onClickedPopup(int index) {
switch(index){
case 0://单击周边搜索图标
Intent intent = new Intent(MyLocation.this, PoiSearch.class);
intent.putExtra("MyLocation", true);
startActivity(intent);
break;
case 1://单击我的位置图标
if(address_msg==null){
Toast.makeText(MyLocation.this, "定位服务进行中...", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(MyLocation.this, "我的位置:"+address_msg, Toast.LENGTH_SHORT).show();
}
break;
case 2://单击线路查询图标
intent = new Intent(MyLocation.this, RoutePlan.class);
intent.putExtra("MyLocation", ""+address_msg);//将地址信息发给线路查询界面
startActivity(intent);
// popup.hidePop();
break;
}
}
});
//单击定位按钮事件
locate=(ImageButton)super.findViewById(R.id.icon_locate);
locate.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(MyLocation.this,"正在定位中,请稍侯...", Toast.LENGTH_SHORT).show();
mLocClient.requestLocation();
}
});
之后会重新定位
安卓市场:http://apk.hiapk.com/html/2013/05/1468059.html?module=256&info=IWjtVg9cqVJLYg%3D%3D
N多市场:http://www.nduoa.com/apk/detail/553415
360手机助手:http://zhushou.360.cn/search/index/?kw=%E6%A0%A1%E5%9B%AD%E5%B0%8F%E5%8A%A9%E6%89%8B
百度应用:http://as.baidu.com/a/item?docid=3101724&pre=web_am_se
优亿市场(eoe):http://www.eoemarket.com/search/apps/?keyword=%E6%A0%A1%E5%9B%AD%E5%B0%8F%E5%8A%A9%E6%89%8B