Invalid layout param in a RelativeLayout: layout_weight

android, android-layout-weight

Solution

Relative layout does not support `weight`.

`Linearlayout` support it. You can use `Linearlayout` like below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="Horizontal">

    <EditText
        android:id="@+id/text_input"    
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:inputType="textMultiLine"
        android:background="@drawable/bg_textinput"
        android:layout_weight="0.7"
        />

    <EditText
        android:id="@+id/text_input1"
        android:layout_width="20dp"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:inputType="textMultiLine"
        android:background="@drawable/bg_textinput"
        />
</LinearLayout>

Problem

I am getting the below error for my android layout file in Eclipse editor : ``` Invalid layout param in a RelativeLayout: layout_weight ``` Layout : ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/text_input" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:inputType="textMultiLine" android:background="@drawable/bg_textinput" android:layout_weight="0.7" /> <EditText android:id="@+id/text_input1" android:layout_width="20dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:inputType="textMultiLine" android:background="@drawable/bg_textinput" android:layout_toRightOf="@id/text_input" /> </RelativeLayout> ``` What's wrong with my layout_weight ?

Original source