These two attributes are commonly confused:
android:gravity
sets the gravity of the content of the View it's
used on. android:layout_gravity
sets the gravity of the View or
Layout relative to its parent.So either put android:gravity="center"
on the parent or android:layout_gravity="center"
on the LinearLayout itself.
I have caught myself a number of times mixing them up and wondering why things weren't centering properly...