How can I get the margin value of a View from an Activity? The View can be of any type.
After a bit of searching I found out ways to get padding of a view, but couldn\'
Try
ViewGroup.MarginLayoutParams vlp = (MarginLayoutParams) view.getLayoutParams() vlp.rightMargin vlp.bottomMargin vlp.leftMargin vlp.topMargin
This returned the correct margains for my view atleast.
http://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html