Hi Darius,

I also tried using the LinearLayout.MarginLayoutParams instead, and it
didn't work either.

Cheers.

On 28 May 2012 17:33, Dariusz Sroka <[email protected]> wrote:

> 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<http://lists.ximian.com/mailman/listinfo/monodroid>
>



-- 
Gonçalo Oliveira
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to