Hi,

You can't use ViewGroup from main namespace - instead try using LinearLayout.LayoutParams (or smth else - I write from memory).

Best regards

W dniu 2012-05-28 18:29, Goncalo Oliveira pisze:
I was trying to set the margins of a view added in runtime, but without success. Is this broken or am I missing something?

..
LinearLayout hostview....
TextView childView....
...
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams( ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent );

layoutParams.TopMargin = <some pixel value>
// also tried SetMargins method

hostView.AddView( childView, layoutParams );

..

This fails. If I add the child in the layout xml file and set the margins, it works, though, I want to do this in runtime as these are dynamically added items. Of course, I can use a xml file for template, but even so, this should work right?


_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to