Please help I need to add -5dp margin but all off this tries not work for me. I don't know why. In axml is margin deffined too. No error or warning in output.
LayoutInflater inflater = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);
layout.RemoveAllViewsInLayout();
for (int current = 0; current < list.Count; current++)
{
RelativeLayout view = inflater.Inflate(Resource.Layout.ListRowLayout, null) as RelativeLayout;
//var param = ((RelativeLayout.LayoutParams)new RelativeLayout.LayoutParameters).TopMargin = -5;// (ViewGroup.LayoutParams.FillParent, 60);
//var param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
var param = new RelativeLayout.LayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent) { TopMargin = -5 });
//param.SetMargins(0, -5, 0, 0);
//param.TopMargin = -5;
view.LayoutParameters = param;
//((ViewGroup)layout).AddView(view);
layout.AddView(view, param);
}