title: inflate an independent linearLayout into other XML defined layout
body: <p>Can I add linearLayouts which is defined in XML in another linearLayout which has a parent containing many layouts. For example in this case I have a parent LinearLayout having to element: a scrollView and a LinearLayout. The scrollView has a LinearLayout which is initially defined empty in the XML. I want to add layouts to this LinearLayout so that if the user exceeds the bottom of the screen then the layouts can be in scrollView.</p>
  
  <pre><code>public class ActivityMain extends Activity implements OnFocusChangeListener{
  
  
  EditText date;
  LinearLayout row[]=new LinearLayout[30];
  int rowNo=0;
  LinearLayout itemForm=(LinearLayout)LinearLayout.inflate(this, R.id.item_form,null);
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_main);
      date=(EditText)findViewById(R.id.date);
      date.setOnFocusChangeListener(this);
  
  
  }
  
  @Override
  public void onFocusChange(View arg0, boolean arg1) {
      // TODO Auto-generated method stub
      if(arg1==false){
  
          row[rowNo++]=(LinearLayout)findViewById(R.layout.row);
          itemForm.addView(row[rowNo]);
  
      }
  }
  
   }
  </code></pre>
  
  <p>This is the XML layout containing the parent LinearLayout with its scrollView and LinearLayout</p>
  
  <pre><code>&lt;LinearLayout 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:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".ActivityMain" 
  android:orientation="vertical"
  android:id="@+id/linearLayout"
  android:weightSum="10"&gt;
  
  &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="8"
      android:orientation="vertical" &gt;
  
  &lt;AutoCompleteTextView
      android:id="@+id/autoCompleteTextView1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:ems="10"
      android:text="AutoCompleteTextView" &gt;
  
      &lt;requestFocus /&gt;
  &lt;/AutoCompleteTextView&gt;
  
  &lt;EditText
      android:id="@+id/date"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:ems="10"
      android:inputType="date" /&gt;
  
  &lt;TextView  android:id="@+id/code"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:ems="10"
      android:text="voucher Code"
      android:textSize="30sp"/&gt;
  
  &lt;/LinearLayout&gt;
  &lt;ScrollView android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="2"&gt;  
  &lt;LinearLayout android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/item_form"
                android:orientation="vertical"&gt;
  
  
  &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>LinearLayout that i want to inflate in the other linearLayout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="horizontal"
  android:id="@+id/row" &gt;
  
  
  &lt;EditText android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:hint="Enter item name"
              android:id="@+id/item"/&gt;
  
    &lt;EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="number"
    android:hint="Quantity"
    android:id="@+id/quant" /&gt;
  
    &lt;EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:hint="Rate"
        android:id="@+id/quant" /&gt;
  
   &lt;/LinearLayout&gt;
  </code></pre>