android+百度地图+动画,Android 百度地图2.4.2版本标注动画效果

ImageView latestMapEventImageView = null;

// 更新震中位置

private void updateMapEventOverlay() {

mMapEventOverlay.removeAll();

if (latestMapEventImageView != null) {

mMapView.removeView(latestMapEventImageView);

latestMapEventImageView.setImageDrawable(null);

latestMapEventImageView = null;

mMapView.refreshDrawableState();

}

for (int i = 0; i < currentEqEventList.size(); i++) {

String eventId = currentEqEventList.get(i).DzEventId;

String eventLevel = currentEqEventList.get(i).DzLevel;

String eventLongitude = currentEqEventList.get(i).DzLon;

String eventLatitude = currentEqEventList.get(i).DzLat;

float fLevel = 0;

float fLatitude = 0;

float fLongitude = 0;

try {

fLevel = Float.parseFloat(eventLevel);

fLongitude = Float.parseFloat(eventLongitude);

fLatitude = Float.parseFloat(eventLatitude);

} catch (Exception e) {

e.printStackTrace();

}

// 转GPS坐标为百度坐标

GeoPoint point = CoordinateConvert.fromWgs84ToBaidu(

new GeoPoint((int)(fLatitude * 1e6), (int)(fLongitude * 1e6)));

OverlayItem item = new OverlayItem(point, eventId, "");

TextView mapEventView;

if (fLevel > 6.9) {

// 大圈

mapEventView = (TextView)findViewById(

R.id.mymap_bottombar_control_dzpos_lv3);

} else if (fLevel > 3.9) {

// 中圈

mapEventView = (TextView)findViewById(

R.id.mymap_bottombar_control_dzpos_lv2);

} else {

// 小圈

mapEventView = (TextView)findViewById(

R.id.mymap_bottombar_control_dzpos_lv1);

}

mapEventView.setText("" + fLevel);

Bitmap bmpMpuMarket = getBitmapFromView(mapEventView);

Drawable drawableMpuMarket = new BitmapDrawable(

getResources(), bmpMpuMarket);

if (i == 0) {

MapView.LayoutParams mapviewLp = new MapView.LayoutParams(

MapView.LayoutParams.WRAP_CONTENT,MapView.LayoutParams.WRAP_CONTENT,

point,MapView.LayoutParams.BOTTOM_CENTER);

latestMapEventImageView=new ImageView(mContext);

latestMapEventImageView.setImageResource(R.drawable.map_icon_earthquake_lv3);

//iv.setImageDrawable(drawableMpuMarket);

AlphaAnimation alphaAnimation1 = new AlphaAnimation(0.1f, 1.0f);

alphaAnimation1.setDuration(1000);

alphaAnimation1.setRepeatCount(Animation.INFINITE);

alphaAnimation1.setRepeatMode(Animation.REVERSE);

latestMapEventImageView.setAnimation(alphaAnimation1);

alphaAnimation1.start();

// Animation anim=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_mapevent);

// iv.setAnimation(anim);

mMapView.addView(latestMapEventImageView,mapviewLp);

}

else {

item.setMarker(drawableMpuMarket);

mMapEventOverlay.addItem(item);

}

}

mMapView.refresh();

}

原文:http://www.cnblogs.com/alwaysyouare/p/4588584.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值