Question: i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available. 

i tried the following but didnt get expected output

```
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">

     <Button android:layout_height="wrap_content" android:layout_width="wrap_content"      android:text="@string/world" android:id="@+id/world"
     android:layout_alignParentRight="true"
     android:layout_toRightOf="@+id/hello"
     android:layout_alignTop="@+id/hello"
  />  

       <Button
          android:id="@+id/hello"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:layout_alignParentLeft="true"
          android:layout_alignParentBottom="true"
        />
   </RelativeLayout>

```

i tried changing the android:layout\_width of both children to fill\_parent but that didnt work too.

i have a working solution of using LinearLayout with layout\_weight set to 0.5 on both childs but i wanted to understand if there is way to do that in relative layout itself.

thanks,

Answer: 
I know that is a old request, but maybe it's can be useful for somebody.

In your case the right solution is using Linear Layout. But for reply your request and suppose that you have an other widget in your layout:

```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent">

 <TextView
    android:id="@+id/tvdescription"        
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:text="description here"/>

 <LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/tvdescription">

    <Button          
        android:id="@+id/world"
        android:layout_height="wrap_content" 
        android:layout_width="0dp"      
        android:text="@string/world"
        android:weight="1"
    />  
   <Button
        android:id="@+id/hello"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:weight="1"
    />
</LinearLayout>

```
You may try implementing LinearLayout(horizontal) and then set android:layout\_weight="1" for both buttons.