Read this:
Gravity and layout_gravity on Android
To make your view aligned center, you can:
LinearLayout case1: 
"android:gravity" is for it's children views. 
If this doesn't works, check it's parent view's width and height.
And, set parent's width and height to bigger size.
 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center" >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TEST" />
</LinearLayout>
LinearLayout case2: 
"android:layout_gravity" is for it self, if parent view has empty spaces.
 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="TEST" />
</LinearLayout>
RelativeLayout
You can use "android:layout_centerInParent" for RelativeLayout.
   <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="TEST" />
</RelativeLayout>