In my application it has a vertical linear layout with id:
@+id/items
In this layout for each item contained in a list, I would like to create another Horizontal Linear Layout called, Row containing 2 ImageButton and an EditText, an ImageButton to be clicked would remove the current item, another would mark the item as correct. p>
Activity XML
<RelativeLayout 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"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.leonardo.quiz.QuestionFormActivity">
<ImageButton
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/btn_media"
android:layout_centerHorizontal="true"
android:contentDescription="@string/ipt_media"
android:src="@drawable/question" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ipt_value"
android:layout_below="@+id/btn_media"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/items"
android:layout_below="@+id/ipt_value"
android:layout_centerHorizontal="true"
></LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_add"
android:id="@+id/btn_add"
android:layout_centerHorizontal="true"
android:layout_below="@id/items"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_back"
android:id="@+id/btn_back"
android:layout_below="@id/btn_add"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_exit"
android:id="@+id/btn_exit"
android:layout_below="@id/btn_back"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_save"
android:id="@+id/btn_save"
android:layout_below="@+id/btn_exit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
However, what is the correct way to fill this LinearLayout entirely in JAVA, reminding you that you will have another LinearLayout containing ImageButton and EditText.