If I understand you correctly, this is certainly possible. The integer
argument is an ID, so you just have to call setId() on your
programmatically created views first (where each ID is unique...), and
then use view.getId() in the addRule() method. See here for a somewhat
more complete explanation:
http://stackoverflow.com/questions/2305395/laying-out-views-in-relativelayout-programmatically

On Jan 24, 9:57 pm, Guy Smith <g...@multiniche.org> wrote:
> I want to create a RelativeLayout in Java code, rather than using the
> XML format.
>
> It seems RelativeLayout.LayoutParams.addRule() would be the way to add
> relative positioning constraints. However, this doesn't take a View
> anchor argument, just an int anchor argument. Does this mean you can
> only use XML-specified Views as the anchor in constraints?
>
> All the examples & tutorials I've found for RelativeLayout assume you
> are using XML-specifications. I'm constructing the layout
> programmatically because the layout is very dynamic - each region of
> the screen has structured content (eg, a crossword square) which
> varies according to the size of the crossword chosen, and the degree
> of zooming.

-- 
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