title: Using DataBinding on custom views
body: <p>I'm trying to create custom view:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"&gt;
  
      &lt;FrameLayout
          android:id="@+id/container_fl"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;ProgressBar
              android:id="@+id/progress_bar"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:indeterminateTint="#FFFFFF" /&gt;
  
      &lt;/FrameLayout&gt;
  
  &lt;/layout&gt;
  </code></pre>
  
  <p>And Java:</p>
  
  <pre><code>public class ImageSlideshowView extends FrameLayout {
      private ViewImageSlideshowBinding binding;
  
      public ImageSlideshowView(@NonNull Context context, @Nullable AttributeSet attrs) {
          super(context, attrs);
  
          init(context);
      }
  
      public ImageSlideshowView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
          super(context, attrs, defStyleAttr);
  
          init(context);
      }
  
      public ImageSlideshowView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
          super(context, attrs, defStyleAttr, defStyleRes);
  
          init(context);
      }
  
      private void init(@NonNull Context context) {
          LayoutInflater layoutInflater = LayoutInflater.from(context);
          binding = ViewImageSlideshowBinding.inflate(layoutInflater, this, true);
      }
  }
  </code></pre>
  
  <p>It works, but not correct.</p>
  
  <p>If I use <code>merge</code> tag instead of FrameLayout without data binding, I'll get the following layout (I finally want to get <strong>this</strong> layout):</p>
  
  <blockquote>
    <p>-- FrameLayout</p>
    
    <p>--- ProgressBar</p>
  </blockquote>
  
  <p>But I can not use <code>merge</code> with data binding, so with XML above I'm getting the following layout:</p>
  
  <blockquote>
    <p>-- FrameLayout</p>
    
    <p>--- FrameLayout</p>
    
    <p>---- ProgressBar</p>
  </blockquote>
  
  <p>As you can see, there is one more FrameLayout created. How to avoid it?</p>