title: Android - How to know if a view overlay another view in RelativeLayout
body: <p>I have a RelativeLayout with two views inside. The view1 is recreated inside the layout in a random position every ten seconds. view2 is in a static position and is bigger then view1. I want to know when the first view is created inside the second view area, how can I do that?</p>
  
  <p>I'm currently trying this code but id doesn't work well.</p>
  
  <pre><code>        if (paramsView1.topMargin &gt; View2Ystart
              &amp;&amp; paramsView1.topMargin &lt; View2Yend
              &amp;&amp; paramsView1.leftMargin &gt; View2Xstart
              &amp;&amp; paramsView1.leftMargin &lt; View2Xend) {
          return true
      }
      else
          return false;
  </code></pre>
  
  <p>It returns true only if view1 is touching a side of view2. I want it returns true only if view1 is totally inside view2.</p>