android:gravitysets the gravity of the content of the
Viewits used on.
android:layout_gravitysets the gravity of the
Layoutin its parent.
And an example is here
Here is the defination of gravity Standard constants and tools for placing an object within a potentially larger container. in developer.android.com and more http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html
android:layout_gravityis the Outside gravity of the View. That means, to specify the direction in which the View should touch it's parent's border.
android:gravityis the Inside gravity of that View. This means, in which direction it's contents should align.
Easy trick to remember: Take "layout-gravity" as "Lay-outside-gravity"
below examples show difference between layout:gravity and gravity,may be help you. http://sandipchitale.blogspot.com/2010/05/linearlayout-gravity-and-layoutgravity.html
Happy Coding !!!