zoukankan      html  css  js  c++  java
  • 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();
        }
    

      

  • 相关阅读:
    PPT中的图像失真
    Delphi GDI对象之绘制文本
    iOS App的加固保护原理
    PHP网站渗透中的奇技淫巧:检查相等时的漏洞
    企业安全建设之浅谈数据防泄露
    常见分布式全局唯一ID生成策略及算法的对比
    写时模式”与“读时模式”之间的对比
    工业互联网环境下IT/OT融合的安全防御技术研究
    一文梳理工业控制系统信息安全软件与监控
    威努特iSoc培训
  • 原文地址:https://www.cnblogs.com/alwaysyouare/p/4588584.html
Copyright © 2011-2022 走看看