title: How to give layout weight in RelativeLayout?
body: <p>I have created a dialpad using <code>LinearLayout</code>. Here is the code</p>
  
  <p></p>
  
  <pre><code>&lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="vertical"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/textView"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:clickable="true"
                  android:text="1" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/tv_two"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:clickable="true"
                  android:text="2" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/tv_three"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="3" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="horizontal"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="4" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="5" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="6" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="vertical"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="7" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="8" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="9" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="vertical"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:clickable="true"
                  android:text="*" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:clickable="true"
                  android:text="0" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textSize="64dp"
                  android:text="#" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Which looks like this</p>
  
  <p><img src="https://i.stack.imgur.com/kTCxr.png" alt="enter image description here"></p>
  
  <p>Now i want the same in <code>RelativeLayout</code>, but i find <code>layout_weight</code> doesn't work in <code>RelativeLayout</code>. I also don't want to use <code>LinearLayout</code> inside <code>RelativeLayout</code>.
  Or is there any alternative which can work same like <code>layout_weight</code> works in <code>LinearLayout</code> but for <code>RelativeLayout</code></p>