コード例 #1
0
  protected void zoomToPoint(float scale, float pointX, float pointY) {
    float cx = getWidth() / 2F;
    float cy = getHeight() / 2F;

    panBy(cx - pointX, cy - pointY);
    zoomTo(scale, cx, cy);
  }
コード例 #2
0
 @Override
 public boolean onKeyUp(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {
     if (getScale() > 1.0f) {
       // If we're zoomed in, pressing Back jumps out to show the
       // entire image, otherwise Back returns the user to the gallery.
       zoomTo(1.0f);
       return true;
     }
   }
   return super.onKeyUp(keyCode, event);
 }
コード例 #3
0
  protected void zoomTo(float scale) {
    float cx = getWidth() / 2F;
    float cy = getHeight() / 2F;

    zoomTo(scale, cx, cy);
  }