private void SetRecyclerViewLayoutHeight(ExpandableListView layout, Android.Support.V7.Widget.Toolbar layoutBelow) { int searchToolBarHeight = mToolBar.Height; int checkoutButtonHeight = rlCheckoutCartButtonContainer.Height; int recyclerViewHeight = layout.Height; int calculatedHeight = recyclerViewHeight - checkoutButtonHeight; int _topMargin = 0; int _bottomMargin = 0; int _leftMargin = 0; //dpToPixel(5); int _rightMargin = 0; //dpToPixel(5); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, calculatedHeight); layoutParams.SetMargins(_leftMargin, _topMargin, _rightMargin, _bottomMargin); layoutParams.AddRule(LayoutRules.Below, layoutBelow.Id); layout.LayoutParameters = layoutParams; layout.RequestLayout(); }