title: layout_weight is not working at all
body: <p>The problem is that I want two linearlayouts inside a linearlayout.And I want those 2 linearlayouts to be aligned vertically according to android:layout_weight property.But it seems that layout_weight is not having any effect. Here is my layout<br></p>
  
  <pre><code>&lt;ScrollView&gt;
      .....
      &lt;LinearLayout&gt;
       ...
         &lt;LinearLayout&gt;                             //1.Here the Linear Layout                                  is not getting aligned properly according to the layout_weight
          ...
             android:layout_height="0dp"
             android:layout_weight="3"
             .
             . 
             .
             .
        &lt;/LinearLayout&gt;
  
        &lt;LinearLayout&gt;                               //2.These two Linear layouts are to be aligned vertically and this second layout is required to use very less space as compared to first layout
         . . . 
             android:layout_height="0dp"
             android:layout_weight="1"
             .
             . 
             .
        &lt;/LinearLayout&gt;
     &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p><br>Here is the full XML code for reference:</p>
  
  <pre><code>    &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;LinearLayout
          android:layout_margin="16dp"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:orientation="vertical"
              android:layout_weight="3" &gt;
  
              &lt;EditText
                  android:id="@+id/edittext"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="16dp"
                  android:layout_marginTop="30dp"
                  android:ems="5"
                  android:hint="Name"
                  android:inputType="text" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="16dp"
                  android:text="Toppings"
                  android:textAllCaps="true" /&gt;
  
              &lt;CheckBox
                  android:id="@+id/whippedcream_checkbox_id"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="16dp"
                  android:paddingLeft="24dp"
                  android:text="Whipped Cream"
                  android:textSize="16sp" /&gt;
  
              &lt;CheckBox
                  android:id="@+id/chocolate_checkbox_id"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="16dp"
                  android:paddingLeft="24dp"
                  android:text="Chocolate"
                  android:textSize="16sp" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="16dp"
                  android:text="Quantity"
                  android:textAllCaps="true" /&gt;
  
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"&gt;
  
                  &lt;Button
                      android:layout_width="48dp"
                      android:layout_height="48dp"
                      android:onClick="decrement"
                      android:text="-" /&gt;
  
                  &lt;TextView
                      android:id="@+id/quantity_text_view"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="8dp"
                      android:layout_marginRight="8dp"
                      android:text="2"
                      android:textColor="@android:color/black"
                      android:textSize="16sp" /&gt;
  
                  &lt;Button
                      android:layout_width="48dp"
                      android:layout_height="48dp"
                      android:onClick="increment"
                      android:text="+" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="16dp"
                  android:text="order summary"
                  android:textAllCaps="true" /&gt;
  
  
              &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="16dp"
                  android:onClick="submitOrder"
                  android:text="Order" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="PRICE:" /&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="Coffee: Rs.5 per cup" /&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="Whipped Cream: Rs.1 per cup additional" /&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="Chocolate: Rs.2 per cup additional" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>