Android2.2.3 实现多点缩放功能

Android2.2.3 实现多点缩放功能:

// 触摸事件        @Override       public boolean onTouchEvent(MotionEvent event) {           if (false == this.is_initialized()) {               return false;           }              try {               PointF point_s = new PointF();               point_s.x = event.getX();               point_s.y = event.getY();               int x = (int) point_s.x;// Float.to( event.getX() );                int y = (int) point_s.y;// Float.floatToIntBits( event.getY() );                   switch (event.getAction() & MotionEvent.ACTION_MASK) {               case MotionEvent.ACTION_DOWN:                   m_pressPt.set(x, y);                   mode = DRAG;                   break;               case MotionEvent.ACTION_UP:                      if (mode == DRAG) {                       int px = x - m_pressPt.x;                       int py = y - m_pressPt.y;                          if (px != 0 && py != 0) {                           m_naviEngine.SetCenter(480 - px, 270 - py);                       }                   }                         mode = NONE;                      break;                                  case MotionEvent.ACTION_POINTER_UP:                   if (mode == ZOOM) {                       float newDist = spacing(event);                       if (newDist > 10f) {                           float scale = newDist - oldDist;                           if (scale > 0) {                               m_levelIndex = getLevelIndex();                               // 设置当前比例尺                                if (m_levelIndex < m_level.length - 1) {                                   m_levelIndex++;                                   m_naviEngine.SetLevel(m_level[m_levelIndex]);                                   m_btnZoomOut.setEnabled(true);                                   if (m_levelIndex == m_level.length - 1) {                                       m_btnZoomIn.setEnabled(false);                                   }                                      // 更新信息弹出框                                    // showPopSign();                                                           }                           } else {                               m_levelIndex = getLevelIndex();                               // 设置当前比例尺以及按钮状态                                if (m_levelIndex > 0) {                                   m_levelIndex--;                                   m_naviEngine.SetLevel(m_level[m_levelIndex]);                                   m_btnZoomIn.setEnabled(true);                                   if (m_levelIndex == 0) {                                       m_btnZoomOut.setEnabled(false);                                   }                                      // 更新信息弹出框                                    // showPopSign();                                }                           }                       }                   }                   break;               case MotionEvent.ACTION_POINTER_DOWN:                   oldDist = spacing(event);                   if (oldDist > 10f) {                          mode = ZOOM;                      }                   break;               }           } catch (UnsatisfiedLinkError e) {               return false;           }              return m_gestureScanner.onTouchEvent(event);       }  

Android获取解析GPS数据

如何为Android Activity设置背景图片?

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyjxjj.html