title: How to add views to scrollview dynamically?
body: <p>I'm tring to add layout views in a scrollView dynamically. i know how to use ListView but in this case i dont want to use ListView. 
  So, first i inflate the layout to view, and than add it to linearLayout inside the ScrollView. the problem is that i can't adding the layout multiply time.</p>
  
  <pre><code>View layoutInflated;
  ScrollView scrollView;
  LinearLayout childView;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_matan);
  
  
      scrollView = (ScrollView) findViewById(R.id.scroll_view_container);
      childView = (LinearLayout) findViewById(R.id.linear_row_container);
      layoutInflated = getLayoutInflater().inflate(R.layout.row_message, scrollView, false);
  
      childView.addView(layoutInflated);
  
  }
  </code></pre>
  
  <p>main.xml:</p>
  
  <pre><code>&lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:onegravity="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:orientation="horizontal"
      android:layout_height="match_parent"&gt;
  
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/scroll_view_container"
          android:layout_gravity="bottom"
          android:fillViewport="false" &gt;
  
          &lt;LinearLayout
              android:id="@+id/linear_row_container"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
  
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>layout "row":</p>
  
  <pre><code>&lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:onegravity="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
  
      android:orientation="vertical"
      android:gravity="center"&gt;
  
      &lt;LinearLayout
          android:id="@+id/toolBar"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:padding="15dp"&gt;
          &lt;include android:id="@+id/rte_toolbar_container" layout="@layout/rte_toolbar"
  
  
  
              /&gt;
  
      &lt;LinearLayout
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_weight="14.23"
       &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="vertical" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/box"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical" &gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginBottom="5dp"
                          android:layout_marginTop="5dp" &gt;
  
                          &lt;ImageView
                              android:id="@+id/row_imgMail"
                              android:layout_width="25dp"
                              android:layout_height="25dp"
                              android:layout_gravity="center"
                              android:layout_marginLeft="5dp"
                              android:scaleType="centerCrop"
                              android:src="@drawable/icon_google" /&gt;
  
                          &lt;TextView
                              android:id="@+id/row_txMailAddres"
                              android:layout_width="0dp"
                              android:layout_height="match_parent"
                              android:layout_marginLeft="8dp"
                              android:layout_weight="1"
                              android:gravity="left|center"
                              android:text="mail@gmail.com"
                              android:textColor="@android:color/black"
                              android:textSize="15sp"
                              android:textStyle="bold" /&gt;
  
                          &lt;CheckBox
                              android:id="@+id/row_cbMail"
                              android:layout_width="wrap_content"
                              android:layout_height="match_parent"
                              android:layout_gravity="center"
                              android:button="@drawable/checkbox_custom" /&gt;
  
                          &lt;ImageButton
                              android:id="@+id/row_btnMagic"
                              android:layout_width="23dp"
                              android:layout_height="23dp"
                              android:layout_marginLeft="10dp"
                              android:layout_marginRight="10dp"
                              android:background="@android:color/transparent"
                              android:scaleType="fitCenter"
                              android:src="@drawable/ic_apply_all_accounts" /&gt;
  
                      &lt;/LinearLayout&gt;
  
                      &lt;View
                          android:layout_width="match_parent"
                          android:layout_height="1dp"
                          android:background="@drawable/shadow_bottom" /&gt;
                  &lt;/LinearLayout&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
  
       &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="1"&gt;
  
          &lt;CheckBox
              android:id="@+id/checkBox"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:button="@drawable/checkbox_custom" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Any idea how to do it ?</p>