title: How do I rearrange my linear layout with weights?
body: <p>I am currently using a linear layout structure that looks as follows:
  <img src="https://i.stack.imgur.com/ywh1n.jpg" alt="enter image description here"></p>
  
  <p>The associated xml code is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;com.handmark.pulltorefresh.library.PullToRefreshLoadMoreScrollView 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/scroll_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/altercolor2"
      android:layout_gravity="top"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:baselineAligned="true"&gt;
  
          &lt;LinearLayout
              android:id="@+id/columnOne"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:layout_weight=".53"
               android:orientation="vertical"&gt;
  
              &lt;include
                 android:id="@+id/first_header"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 layout="@layout/item_header" /&gt;
  
             &lt;LinearLayout
                 android:id="@+id/first_container"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight=".47"
            android:orientation="vertical"&gt;
  
              &lt;include
                   android:id="@+id/second_header"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   layout="@layout/item_header" /&gt;
  
              &lt;LinearLayout
                 android:id="@+id/second_container"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:orientation="vertical"
                 android:gravity="top" /&gt;
  
              &lt;include
                  android:id="@+id/third_header"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  layout="@layout/item_header" /&gt;
  
              &lt;LinearLayout
                  android:id="@+id/third_container"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical" /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/com.handmark.pulltorefresh.library.PullToRefreshLoadMoreScrollView&gt;
  </code></pre>
  
  <p>However, I would like to rearrange that so that it looks like:
  <img src="https://i.stack.imgur.com/s489n.jpg" alt="enter image description here"></p>
  
  <p>Is there a way I can rearrange the same with linearlayout? or do I have to use some other form of layout like relativelayout. I am pretty confused about the same. Also, would like to include the headers with the containers(the include code), is there a way I can easily achieve this?</p>
  
  <p>Thanks!</p>
  
  <p>After altering a code a bit, i had a little success moving the second header and second layout on top, but the first header is next to first layout instead on top, and same for third.Is there a way to fix it? I have attached the image here:
  <img src="https://i.stack.imgur.com/jxoF7.jpg" alt="enter image description here"></p>
  
  <p>and the code is as follows:</p>
  
  <pre><code>&lt;com.handmark.pulltorefresh.library.PullToRefreshLoadMoreScrollView 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/scroll_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/altercolor2"
      android:layout_gravity="top"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:baselineAligned="true"&gt;
  
          &lt;LinearLayout
              android:id="@+id/columnOne"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="vertical"&gt;
  
              &lt;include
                 android:id="@+id/second_header"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 layout="@layout/item_header" /&gt;
  
             &lt;LinearLayout
                 android:id="@+id/second_container"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:baselineAligned="true"&gt;
  
              &lt;include
                   android:id="@+id/first_header"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:layout_weight="0.50"
                   layout="@layout/item_dashboard_header" /&gt;
  
              &lt;LinearLayout
                 android:id="@+id/first_container"
                 android:layout_width="match_parent"
                 android:layout_weight="0.50"
                 android:layout_height="wrap_content"
                 android:orientation="vertical"
                 /&gt;
  
              &lt;include
                  android:id="@+id/third_header"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.50"
                  layout="@layout/item_dashboard_header" /&gt;
  
              &lt;LinearLayout
                  android:id="@+id/third_container"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.50"
                  android:orientation="vertical" /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/com.handmark.pulltorefresh.library.PullToRefreshLoadMoreScrollView&gt;
  </code></pre>