set layout component to center
<p><img src="http://i.stack.imgur.com/TjcXp.jpg" alt="enter image description here"></p>

<p>here in above screen, i have two linear layouts, one for two TextView and two EditText and other layout for Three Button as shown in figure,</p>

<p>Now I want to set these two layouts as below:</p>

<p>1) The first layout is required to set at the center of the screen</p>

<p>2) The all buttons or second layout have to be set on the bottom of screen</p>

<p>So I want to ask how i can do this.</p>

<p>My XML file is</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="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical"
    android:background="#000044"&gt;
    &lt;ScrollView android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_width="match_parent"&gt;
        &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content" android:layout_gravity="center"&gt;
            &lt;TextView android:text="Login Phone" style="@style/TextStyle.Default" android:id="@+id/loginphone"&gt;&lt;/TextView&gt;
            &lt;EditText android:layout_height="wrap_content" android:id="@+id/login" android:layout_width="match_parent" android:text="" android:inputType="number" android:numeric="integer" android:phoneNumber="true"&gt;&lt;/EditText&gt;
            &lt;TextView android:text="Mobile Pin" android:id="@+id/mobilepin" style="@style/TextStyle.Default"&gt;&lt;/TextView&gt;
            &lt;EditText android:layout_height="wrap_content" android:id="@+id/pin" android:inputType="number" android:numeric="integer" android:layout_width="match_parent" android:text="" android:password="true"&gt;&lt;/EditText&gt;
        &lt;/LinearLayout&gt;
    &lt;/ScrollView&gt;
    &lt;LinearLayout android:id="@+id/linearLayout2" android:layout_height="match_parent" android:layout_gravity="bottom" android:layout_width="fill_parent" android:orientation="horizontal" android:gravity="bottom"&gt;
        &lt;Button android:id="@+id/preference" android:text="Preferences" android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;&lt;/Button&gt;
        &lt;Button android:id="@+id/loginbutton" android:text="Login" android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;&lt;/Button&gt;
        &lt;Button android:id="@+id/exit" android:text="Exit" android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;&lt;/Button&gt;
    &lt;/LinearLayout&gt;    

&lt;/LinearLayout&gt;
</code></pre>
