I have a LinearLayout which should contains a list of items (each item is a LinearLayout).
The problem is that the childs items (LinearLayouts) are not displayed one below another: just the fist one is visible.
This is my layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="@+id/label_TextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:paddingLeft="@dimen/form_label_padding_left"
android:text="" />
<LinearLayout
android:id="@+id/form_list_holder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:orientation="horizontal"
android:background="@color/form_list_background" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/label_TextView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:paddingLeft="@dimen/form_label_padding_left"
android:text="1" />
<EditText
android:id="@+id/edtx_input1"
android:layout_width="0dp"
android:layout_height="@dimen/form_input_height"
android:layout_marginTop="@dimen/form_edittext_margin_top"
android:layout_weight="5" />
<EditText
android:id="@+id/edtx_remark1"
android:layout_width="0dp"
android:layout_height="@dimen/form_input_height"
android:layout_marginTop="@dimen/form_edittext_margin_top"
android:layout_weight="3"
android:hint="@string/remarks"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/label_TextView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:paddingLeft="@dimen/form_label_padding_left"
android:text="1" />
<EditText
android:id="@+id/edtx_input2"
android:layout_width="0dp"
android:layout_height="@dimen/form_input_height"
android:layout_marginTop="@dimen/form_edittext_margin_top"
android:layout_weight="5" />
<EditText
android:id="@+id/edtx_remark2"
android:layout_width="0dp"
android:layout_height="@dimen/form_input_height"
android:layout_marginTop="@dimen/form_edittext_margin_top"
android:layout_weight="3"
android:hint="@string/remarks"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
Do you know why this is happen? I thought that in a LinearLayout if there is not more available space on current line, the childs will be displayed on the next line.
Your
LinearLayoutwhose id isform_list_holderhas aandroid:orientation="horizontal".The orientation should be Vertical instead usign
android:orientation="vertical"