• 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();
        }
    

      

  • 相关阅读:
    elementUI Select 下拉框列表分两列展示
    radio切换后,表格数据记住之前选中的行
    vue 子组件和父组件生命周期顺序
    vue-router理解
    vuex理解
    实验四 决策树算法及应用
    实验三 朴素贝叶斯算法及应用
    实验二 K-近邻算法及应用
    词法分析可视化MFC
    SEO工具ahrefs各参数详解
  • 原文地址:https://www.cnblogs.com/alwaysyouare/p/4588584.html
Copyright © 2020-2023  润新知