title: Different results when using the LayoutInflator's inflate methods
body: <p>I want to know how the <code>LayoutParams</code> will work on <code>LayoutInflator</code>. And what is difference between:</p>
  
  <pre><code>LinearLayout childLayout=(LinearLayout)inflater.inflate(R.layout.childitemlayout, null); //FIRST WAY
  LinearLayout childLayout=(LinearLayout)inflater.inflate(R.layout.childitemlayout, container,false); //SECOND WAY
  </code></pre>
  
  <p>Because, both methods gives me different result.
  Actually second inflate method are gives me correct result for both child layout change, but First method will gives me different result.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>MainActivity.Java
  
  @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          LinearLayout mainLayout=(LinearLayout)findViewById(R.id.mainLayout);
          LayoutInflater inflater=LayoutInflater.from(getApplicationContext());
          for(int i=0;i&lt;10;i++){
              LinearLayout childLayout=(LinearLayout)inflater.inflate(R.layout.childitemlayout, null); //First WAY
  //          LinearLayout childLayout=(LinearLayout)inflater.inflate(R.layout.childitemlayout, mainLayout,false);  //SECOND WAY
              mainLayout.addView(childLayout);
          }
      }
  
  
  main.xml
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/mainLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal" &gt;
  
  &lt;/LinearLayout&gt;
  
  
  childitemlayout.xml
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="80dp"
      android:layout_height="80dp"
      android:orientation="vertical" 
      android:background="#525f67"&gt;
  
      &lt;TextView android:id="@+id/btn"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:text="Button"
              android:gravity="center"
              /&gt;
  
  
  &lt;/LinearLayout&gt;  &lt;!-- Both ways gives different result  --&gt; 
  
  
  &lt;!-- 
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical" 
      android:background="#525f67"&gt;
  
      &lt;TextView android:id="@+id/btn"
              android:layout_width="80dp"
              android:layout_height="80dp"
              android:text="Button"
              android:gravity="center"
              /&gt;
  
  
  &lt;/LinearLayout&gt; Both method gives SAME result   --&gt;  
  </code></pre>