Question: I came through many examples in internet.I found that neither [Relative Layout](http://groups.google.com/group/android-developers/browse_thread/thread/7410e21361bb1b?pli=1&utoken=qermjzMAAACwwFf96muIoaCUrXmA7_-MtsptRi98cuuIV_52pB4u_ZOkqwdthaiabeNm1JAUGW3LrSuCiuRVvVFVbXv2kwMM) nor [Linear Layout](http://thinkandroid.wordpress.com/2010/01/14/how-to-position-views-properly-in-layouts/) supports android:layout\_gravity.By it I mean the views inside these layouts does not support android:layout\_gravity attribute. So any one having idea which layout supports android:layout\_gravity and how to use it in better way?

Answer: 
Children (that is, direct descendants in the View hierarchy) of LinearLayout do use layout\_gravity (see [LinearLayout.LayoutParams](http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html)), but only on the "secondary" axis. So, in a vertical LinearLayout, center\_horiztonal will work, but center\_vertical will do nothing. 

Children of FrameLayout also support layout\_gravity (see [FrameLayout.LayoutParams](http://developer.android.com/reference/android/widget/FrameLayout.LayoutParams.html)). 

Keep in mind that the layout\_\* parameters set values in a [LayoutParams](http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) object provided by the view parent. So a layout\_\* parameter will only have an effect if the parent view supports the parameter.
Actually if you use RelativeLayout you don't need to use `layout_gravity`.Better way to position your layout's elements are android. Here you can get a good explanation how to use [RelativeLayout](http://www.learn-android.com/2010/01/05/android-layout-tutorial/5/).