title: How to set Image position relative to another Image on Android
body: <p>I try to explain my problem. I have two ImageViews. 
  One of them is the background image and large as well.</p>
  
  <p>This background image has also a zoom function. The other Image is a small image with size of 36x36. </p>
  
  <p>The small image can be moved around the screen:</p>
  
  <pre><code>public boolean onTouch(View view, MotionEvent event) {
      final int X = (int) event.getRawX();
      final int Y = (int) event.getRawY();
      //Definition MotionEvent.ACTION_MASK: Bit mask of the parts of the action code that are the action itself.
      switch (event.getAction() &amp; MotionEvent.ACTION_MASK) {
          case MotionEvent.ACTION_DOWN:
              RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
              _xDelta = X - lParams.leftMargin;
              _yDelta = Y - lParams.topMargin;
              break;
          case MotionEvent.ACTION_UP:
              break;
          case MotionEvent.ACTION_POINTER_DOWN:
              break;
          case MotionEvent.ACTION_POINTER_UP:
              break;
          case MotionEvent.ACTION_MOVE:
              RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view
                      .getLayoutParams();
              layoutParams.leftMargin = X - _xDelta;
              layoutParams.topMargin = Y - _yDelta;
              layoutParams.rightMargin = -250;
              layoutParams.bottomMargin = -250;
              view.setLayoutParams(layoutParams);
              break;
      }
      viewGroup.invalidate();
      return true;
  }
  </code></pre>
  
  <p>If i zoom in the background image, the small image doesn't zoom. It's position is absolute to the screen and not to the Image.</p>
  
  <p>How can i make the small Image to be relative to the large Image? </p>
  
  <p>I hope it's clear what my Problem is.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:id="@+id/root"&gt;
  
      &lt;ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:id="@+id/skizze"
          android:scaleType="matrix"
          /&gt;
  
      &lt;ImageView
          android:layout_width="55dp"
          android:layout_height="55dp"
          android:id="@+id/feuerloescher"
          android:layout_gravity="center_horizontal|top"
          android:layout_alignParentTop="false"
          android:src="@drawable/feuerloescher"
          android:layout_alignParentStart="true"
          android:layout_alignParentEnd="false" /&gt;
  
  &lt;/RelativeLayout&gt;</code></pre>
  </div>
  </div>
  </p>