title: android programming auto margin as in css
body: <p>I am very new to android programming.I have learned css and I want to make margin 0 auto like in css.This is my code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.qwe.androidtutorial_1.Layout"&gt;
  
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="300dp"
          android:layout_height="400dp"
          android:orientation="vertical"
          android:layout_marginLeft="0dp"
          android:gravity="center_horizontal"
          android:layout_gravity="center"&gt;
  
  
          &lt;EditText
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:hint="@string/alici"
              android:visibility="visible"
              android:gravity="center"
              /&gt;
  
          &lt;EditText
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:hint="@string/konu"
              android:visibility="visible"
              android:gravity="center" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is how my design looks like => <a href="http://i.stack.imgur.com/jizLa.png" rel="nofollow">IMAGE 1</a> </p>
  
  <p>I want to design like this =><a href="http://i.stack.imgur.com/62IIi.png" rel="nofollow">IMAGE 2</a></p>
  
  <p>I want to make this using margin 0 auto(as in css) which makes linearlayout perfectly vertically center in relativelayout.How can I make this?</p>