I was needing to get the value of the gravity of a LinearLayout. I checked the documentation and I only found how to set it ( setGravity(value) ).
LinearLayout
setGravity(value)
You should get it from the LayoutParams of the LinearLayout:
mLinearLayout.getLayoutParams().gravity
@see doc of LinearLayout.LayoutParams:
public int gravity Gravity for the view associated with these LayoutParams.