title: Differences between View create with xml - View create with code
body: <p>There is a difference when I'm trying to add programmatically RelativeLayout and when I use directly xml view.</p>
  
  <p>If I copy paste several RelativeLayout in container_tabs it works.. </p>
  
  <p>And when I try to inflate a relativeLayout file (exactly same as into container_tabs) the result is different and it doesn't works.</p>
  
  <p><strong>How I fill my view programmatically</strong></p>
  
  <pre><code>    @BindView(R.id.container_tabs)
      protected LinearLayout mLinearLayoutContainerTabs;
  
      private List&lt;CustomBookingTab&gt; mBookingTabsList = new ArrayList&lt;&gt;();
  
      private void initCustomButtonsTabs() {
         mBookingTabsList.add(new CustomBookingTab(this, EnumBookingTab.BOOKING_TAB_CALENDAR, R.drawable.ic_calendar_white));
         mBookingTabsList.add(new CustomBookingTab(this, EnumBookingTab.BOOKING_TAB_TIME, R.drawable.ic_clock));
  
  
         for (int i = 0; i &lt; mBookingTabsList.size(); i++) {
              mLinearLayoutContainerTabs.addView(mBookingTabsList.get(i).getRelativeLayoutBookingTab(), i);
         }
      }
  </code></pre>
  
  <p><strong>How I inflate my view from a xml file (CustomBookingTab constructor)</strong></p>
  
  <pre><code>mRelativeLayoutBookingTab = (RelativeLayout) inflater.inflate(R.layout.booking_tab, null);
  </code></pre>
  
  <p><strong>Main view</strong></p>
  
  <pre><code>    &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="-29dp"
          android:orientation="horizontal"&gt;
  
          &lt;LinearLayout
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="horizontal"&gt;
  
              &lt;LinearLayout
                  android:id="@+id/container_tabs"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_gravity="center"
                  android:gravity="center"
                  android:orientation="horizontal"&gt;
  
                  &lt;!-- Tab item --&gt;
                  &lt;RelativeLayout
                      android:layout_width="0dp"
                      android:layout_height="70dp"
                      android:layout_gravity="center"
                      android:layout_weight="1"&gt;
  
                      &lt;FrameLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"&gt;
  
                          &lt;ImageView
                              android:layout_width="70dp"
                              android:layout_height="70dp"
                              android:layout_alignParentLeft="true"
                              android:background="@drawable/circle_blue_button_border_white"
                              android:padding="21dp"
                              android:src="@drawable/ic_calendar_white"
                              android:text="Button"
                              android:textColor="#FFFFFF"
                              android:textSize="30sp" /&gt;
  
                      &lt;/FrameLayout&gt;
  
                  &lt;/RelativeLayout&gt;
  
  
              &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Is there a good way to do that? What is wrong?</p>