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.
LinearLayout main = (LinearLayout)findViewById(R.id.sendlayout);
View childview = getLayoutInflater().inflate(R.layout.imageviewlayout, main,false);
main.addView(childview);
here is my imageviewlayout(child):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<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" />
</LinearLayout>