Hi Becca, It's very simple, you can do something like the following:
LayoutParams layoutParams = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.ABOVE, myView.getId()); Where myView is the view you want to be above. Make sure you call setId to programmatically assign an id. Extra tip: If you're using the layout params on a View that will be instantiated frequently (like a ListView child), you can create a single static instance of your LayoutParams (initialize it in a static block), and reuse it for all items (for id's assign predefined constants. They don't have to be globally unique) Lior UltimateFavesPRO developer. http://ultimatefaves.wordpress.com On Nov 23, 5:13 pm, Becca <[email protected]> wrote: > Hello, > > I need to dynamically change the layout_above value for a ListView > within a RelativeLayout. I know that within the XML, all you need is > android:layout_above="@id/myid", but what is the equivalent if I want > to do this in my java code? > > Thanks, > > Becca -- 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

