title: How to add & stack childView to a LinearLayout?
body: <p>I got <code>The specified child already has a parent. You must call removeView() on the child's parent first.</code> ERROR.</p>
  
  <p>But I do not want to remove the parent view.</p>
  
  <p>If you click a button, a message must be added at the end of LinearLayout's childViews.</p>
  
  <p>This is my Java code:</p>
  
  <pre><code>    Button addBTN = findViewById(R.id.addButton);
      LinearLayout messageListLL = findViewById(R.id.messageList_LinearLayout);
      addBTN.setOnClickListener((v) -&gt; {
          MessageItem messageItem = new MessageItem();
          View messageView = View.inflate(this, R.layout.item_message, messageListLL);
          messageListLL.addView(messageView, messageListLL.getChildCount());
      });
  </code></pre>
  
  <p>This is the part of activity's xml:</p>
  
  <pre><code>&lt;ScrollView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_above="@id/adView"
      android:layout_below="@id/userContainer"
      android:background="#CCC"
      android:padding="15dp"&gt;
  
      &lt;LinearLayout
          android:id="@+id/messageList_LinearLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
  
          &lt;Button
              android:id="@+id/addButton"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:backgroundTint="@color/design_default_color_primary"
              android:text="ADD"
              android:textColor="@android:color/white" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>This is item_message.xml:</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="wrap_content"
  android:layout_centerVertical="true"
  android:orientation="vertical"&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="left" /&gt;
  
      &lt;EditText
          android:layout_width="300dp"
          android:layout_height="wrap_content" /&gt;
  
      &lt;ImageView
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:layout_gravity="right"
          android:background="#FFD9D9" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>So, I'd like to make a view with <code>item_message</code> and put it into <code>LinearLayout</code> in the activity's xml, which has <code>messageList_LinearLayout</code> for the id attribute.</p>
  
  <p>The button is also in the LinearLayout. The button must be placed at the end of the LinearLayout. </p>
  
  <p>And whenever, I click the button, a message view must be created and added at the end of the messageList and also before the button.</p>