title: How to position a inflated layout at the center of parent layout
body: <p>I am inflating a layout(imageviewlayout) in Main layout.I am getting the child view at t he bottom of parent view.How can I align the child view at the center of Mainlayout.I have read that it can be done using Layoutparams .can you please tell how to align the child view at the center of main layout.</p>
  
  <pre><code>LinearLayout main = (LinearLayout)findViewById(R.id.sendlayout);
  View childview = getLayoutInflater().inflate(R.layout.imageviewlayout, main,false);          
  main.addView(childview);
  </code></pre>
  
  <p>here is my imageviewlayout(child):</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  
      android:layout_width="match_parent"
  
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
       &lt;ImageView
          android:id="@+id/thumbnailImage"
          android:layout_width="250px"
          android:layout_height="250px"
          android:layout_gravity="center_horizontal"
          android:scaleType="fitCenter"
          android:src="@drawable/camera" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>