title: Android: Draw rectangle over SVGImageView with zoom-in/out
body: <p>In essence, I'm trying to layer multiple ImageViews (one of which is a floor plan, the other a rectangle) on top of each other while still allowing for pinch-zooming.  The effect I'm going for is very similar to this post: http:/ /stackoverflow.com/questions/10482229/draw-rectangle-over-imageview-for-highlight-that-can-be-zoom-in-out-in-android?rq=1.  However, I want the rectangle to appear at application startup (as opposed to when the user taps the screen) and to update its position over time.</p>
  
  <p>One of my images is an SVG file of a floor plan.  I'm using the AndroidSVG library (https:/ /code.google.com/p/androidsvg/) to render it to Android as an SVGImageView.  My current implementation allows for pinch-zooming and panning of this SVG file (on application startup: http:/ /imgur.com/SceJuni; after pinch-zooming: http:/ /imgur.com/wL8anKd).</p>
  
  <p>(Sorry for the space in the links; I don't have 10 reputation points so I can't post more than one link)</p>
  
  <p>Now I need to overlay this SVGImageView with a rectangle to denote a location on this map.  I want this rectangle to zoom in and out as the SVGImageView zooms in and out.  I considered using the ScaleImageView class from this link (https:/ /github.com/matabii/scale-imageview-android) but now I am unsure how to proceed.</p>
  
  <p>Here's the repo: <a href="https://github.com/mthai95/SVGApp" rel="nofollow">https://github.com/mthai95/SVGApp</a></p>
  
  <p>And heres what I have so far:</p>
  
  <pre><code>import android.app.Activity;
  import android.graphics.*;
  import android.os.Bundle;
  import android.util.FloatMath;
  import android.util.Log;
  import android.view.MotionEvent;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import com.caverock.androidsvg.SVGImageView;
  
  public void onCreate(Bundle savedInstanceBundle) {
      super.onCreate(savedInstanceState);
      LinearLayout layout = new LinearLayout(this);
      SVGImageView svgImageView = new SVGImageView(this);
      svgImageView.setImageAsset("w1a.svg");
      svgImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      svgImageView.setOnTouchListener(new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              ... pinch-zoom and pan ...
          }
      });
      layout.addView(svgImageView,
              new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
      setContentView(layout);
  }
  </code></pre>