Android 百度地圖2.4.2版本標註動畫效果

來源:互聯網
上載者:User

標籤:

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

  

Android 百度地圖2.4.2版本標註動畫效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.