title: Android DataBinding layout_width : You must supply a layout_width attribut
body: <p>I'm trying to bind the width and height of my view but I can't see where's the problem.</p>
  
  <p>I found this on <a href="https://code.google.com/p/android/issues/detail?id=180666*" rel="noreferrer">this google issue</a></p>
  
  <blockquote>
    <p>To implement these for your application, create a binding adapter:</p>
  
  <pre><code>@BindingAdapter("android:layout_width")
  public static void setLayoutWidth(View view, int width) {
    LayoutParams layoutParams = view.getLayoutParams();
    layoutParams.width = width;
    view.setLayoutParams(layoutParams);
  }
  </code></pre>
  </blockquote>
  
  <p>So I created my Binding Adapter like this :</p>
  
  <pre><code>public class SimpleBindingAdapter {
  
      @BindingAdapter("android:layout_width")
      public static void setLayoutWidth(View view, int width) {
          ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
          layoutParams.width = width;
          view.setLayoutParams(layoutParams);
      }
  
      @BindingAdapter("android:layout_height")
      public static void setLayoutHeight(View view, int height) {
          ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
          layoutParams.height = height;
          view.setLayoutParams(layoutParams);
      }
  
      //Others methods...
  }
  </code></pre>
  
  <p>And then try to set my width and height like this :</p>
  
  <pre><code>&lt;View
          android:layout_width="@{paramsMessage.width}"
          android:layout_height="@{paramsMessage.height}"
  ... /&gt;
  </code></pre>
  
  <p>Where paramsMessage.width is a public int attribute.</p>
  
  <p>But I get this error :</p>
  
  <blockquote>
    <p>Caused by: java.lang.RuntimeException: Binary XML file line #25: You
    must supply a layout_width attribute.
                                                                                       at
    android.content.res.TypedArray.getLayoutDimension(TypedArray.java:607)
                                                                                       at
    android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6761)
                                                                                       at
    android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:6930)
                                                                                       at
    android.widget.RelativeLayout$LayoutParams.(RelativeLayout.java:1244)
                                                                                       at
    android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:1084)
                                                                                       at
    android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:83)
                                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:820)
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
                                                                                       at
    android.databinding.DataBindingUtil.inflate(DataBindingUtil.java:116)
                                                                                       at
    android.databinding.DataBindingUtil.inflate(DataBindingUtil.java:88)
                                                                                       at
    be.standard.appbusiness.tutorials.home.TutorialHomeFragment.onCreateDialog(TutorialHomeFragment.java:35)
                                                                                       at
    android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:308)
                                                                                       at
    android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                                       at
    android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
                                                                                       at
    android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
                                                                                       at
    android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613)
                                                                                       at
    android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
                                                                                       at
    android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
                                                                                       at
    android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
                                                                                       at android.app.Activity.performStart(Activity.java:6258)
                                                                                       at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2621)
                                                                                       at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723) 
                                                                                       at android.app.ActivityThread.access$900(ActivityThread.java:172) 
                                                                                       at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422) 
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                       at android.os.Looper.loop(Looper.java:145) 
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:5832) 
                                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                                       at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                                       at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) 
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)</p>
  </blockquote>
  
  <p> 
  I would appreciate any helps on this, thank you !</p>