On 21 February 2012 14:53, Marcin Orlowski <webnet.andr...@gmail.com> wrote:


> I am trying to set android:layout_alignParentTop and
> android:layout_alignParentLeft on view I create from code but I do not see
> a way to achieve that. Am I missing something or these params can only be
> set in XML?
>

For archiving purposes:

LinearLayout l = new LinearLayout(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(50,
50);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
l.setLayoutParams( params );

Regards,
Marcin Orlowski

*Tray Agenda <http://bit.ly/trayagenda>* - keep you daily schedule handy...
*Date In Tray* <http://bit.ly/dateintraypro> - current date at glance...
WebnetMobile on *Facebook <http://webnetmobile.com/fb/>*,
*Google+*<http://bit.ly/webnetmobile-gp>and
*Twitter <http://webnetmobile.com/twitter/>*

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to