I got this to work with addrule and RelativeLayout.LayoutParams
// center my_textbox
RelativeLayout.LayoutParams params_center = new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
params_center.addRule(RelativeLayout.CENTER_IN_PARENT);
// add my_textbox
l.addView(my_textbox, params_center);
You could do this similarly with all types of dynamic view additions
(given appropriate rules) so far as I can tell.
Thanks guys.
On Jul 30, 3:08 pm, Mark Murphy <[email protected]> wrote:
> doubleslash wrote:
> >> Just like John and Pavel, I cannot figure out how to set some
> >> RelativeLayout XML attributes programmatically in Java.
>
> >> For example, I cannot find a programmatic way to define
> >> "layout_centerVertical=true" with only Java.
>
> http://developer.android.com/reference/android/widget/RelativeLayout....
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, $35/Year
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---