title: Send current view to ViewModel using DataBinding
body: <p>I have a <code>BindingAdapter</code> like</p>
  
  <pre><code>@BindingAdapter({ "onGlobalLayout" })
  public static void setOnGlobalLayout(View view, ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
      ViewTreeObserver vto = view.getViewTreeObserver();
      vto.addOnGlobalLayoutListener(onGlobalLayoutListener);
  }
  </code></pre>
  
  <p>In XML I have a <code>View</code> like</p>
  
  <pre><code>    &lt;View
          android:id="@+id/viewId"
          bind:onGlobalLayout="@{viewModel.onLayoutListener}"
          /&gt;
  </code></pre>
  
  <p>In ViewModel I have</p>
  
  <pre><code>public ViewTreeObserver.OnGlobalLayoutListener onLayoutListener(View view){
          return new ViewTreeObserver.OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                   // get x,y,width, height of view           
              }
          };
  }
  </code></pre>
  
  <p>Now I want to send the current <code>View</code> to <code>ViewModel</code> so I add a parametter <code>View view</code> to <code>onLayoutListener</code> but in XML I don't know how to send it.<br>
  Any help or suggestion would be great appreciated</p>
  
  <p><strong>UPDATE</strong>
  Thank @pskink for suggest a better way for checking layout change. 
  With <code>android:onLayoutChange</code> I don't need <code>BindingAdapter</code></p>
  
  <pre><code>&lt;View
       android:id="@+id/viewId"
       android:onLayoutChange="@{viewModel.onLayoutListener(viewId)}"
  /&gt;
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>public View.OnLayoutChangeListener onLayoutUpdateWeightSuccessfulListener(final View v) {
          return new View.OnLayoutChangeListener() {
              @Override
              public void onLayoutChange(View v, int left, int top, int right, int bottom,
                      int oldLeft, int oldTop, int oldRight, int oldBottom) {
                      // left, top
              }
          };
      }
  </code></pre>